Wordpress
Display and Highlight Code in your Wordpress blog without any plugins
If you have ever tried to add PHP or some other programming code like CSS, HTML etc. in your Wordpress blog, you will know what happens, Wordpress will run it instead of showing it as code if you put it using HTML editor. There are many Wordpress plugins out there to make the job easier but I wanted the functionality of displaying and highlighting code in Wordpress posts without having to use any plugins.
Wordpress will only show the code properly if characters are used for code elements, see below:
< = <
> = >
/ = /
] = ]
[ = [
" = "
' = '
Displaying Code properly without using any Plugin
Its not very simple to use characters instead of the code elements. What you should keep in mind is to always write your post/paste code in Visual mode of the Wordpress editor instead of HTML, it will convert the code elements into characters automatically, displaying it correctly within code tags.
Highlighting Code without using any Plugin
Now the code will be shown correctly on your blog but thanks to easy CSS management in Wordpress, you can add/edit a few lines of code in your theme’s stylesheet (style.css) to highlight the code so it stands out from rest of the post. Edit your theme’s stylesheet either by FTP or within Wordpress Admin area and look for:
code {
font-size:12px;
}
You can edit it to your liking, setting background colour, text colour, border, margin, padding, everything that CSS can do for you. If you have any questions, feel free to ask in comments.
How to remove comment author’s URL from your Wordpress blog?
I recently came across an excellent read about the secrets of comments.php in Wordpress by Gilles Maes at Net-Tuts, and I thought of testing this immediately, how to remove comment author’s URL from your Wordpress blog. Now it is there for a reason, and I do not really recommend doing this but then the quality of some links is extremely low. I usually edit out questionable links from author and allow the comment when reasonable but I can’t imagine doing that all the time and certainly not on a blog with very big audience.
You can also simply remove URL field from comments.php but I won’t do that if I were you, simply because down the line some day you might want to get them back, so let them live in the database but not show if you have a problem with it.
Now in order to remove comment author’s URL, link or website, look for the following code under comments.php of the theme you are using.
<?php comment_author_link(); ?>
and remove _link so it looks like,
<?php comment_author(); ?>
that’s it, you are done. If you are having any trouble then feel free to ask me.
“Fatal error: Class ’scbWidget’ not found” Solution
New version of the popular Wordpress Plugin WP-UserOnline version 2.60 has arrived but with a problem. A small piece of code is missing for some reason and it gives the following error when its being enabled.
Fatal error: Class ’scbWidget’ not found in /wp-content/plugins/wp-useronline/wp-useronline.php on line 515
The solution for it is very simple; if you have upgraded to version 2.60 and are getting the fatal error then login to your FTP and edit wp-useronline.php file, the fault lies in very first line so it’s very easy to find. It currently looks like,
< ?php
/*
Plugin Name: WP-UserOnline
All you have to do is add include ’scb/Widget.php’; under the very first line so it looks like this.
< ?php
include 'scb/Widget.php';
/*
Plugin Name: WP-UserOnline
(Remove the space between < and ? php
and you are done, just activate the plugin. For those of you who are either lazy ;) or do not understand what I am talking about. Here's updated version of the Plugin with the fix applied to it. Just download it, login to your Wordpress and add it via upload.
http://rapidshare.com/files/349568652/wp-useronline.2.60.zip.html
You can retweet and Digg this to all of your friends and you can also follow me on twitter @ http://twitter.com/thepatri0t




