Ramin Hossaini (blog)

9Jan/100

Stop Wordpress from adding p and br tags

Even without the visual-editor, Wordpress has a habit of adding <p> and <br/> tags

Add this to your templates/pages/whatever and it should take care of the problem.

<?php remove_filter('the_content', 'wpautop'); ?>
Tagged as: No Comments
19Oct/090

Wordpress BlogInfo variables

bloginfo('atom_url');       //ATOM feed for site
bloginfo('charset');        //The character set
bloginfo('description');    //The description of the blog
bloginfo('html_type');      //HTML version of the site
bloginfo('name');           //Title of blog
bloginfo('pingback_url');   //The pingback URL
bloginfo('rss2_url');       //The RSS URL
bloginfo('stylesheet_url'); //The URL for the template's CSS file
bloginfo('template_url');   //The URL of the template
bloginfo('url');            //The address of the blog
bloginfo('version');        //Version of the WordPress installation
bloginfo('wpurl');          //URL for WordPress installation
Tagged as: No Comments
23Sep/090

Highlight comments by Blog-author (Wordpress)

If you'd like to distinguish your own comments from the comments of your visitors, here's how to highlight your comments with just a line of CSS - no extra plugins or unnecessary code.

1
2
3
.bypostauthor { 
    background-color:#PLACE_YOUR_COLOUR_HERE !important; 
}

This works for Wordpress versions 2.7+

1Nov/080

Wordpress 2.7 Beta 1

The new Wordpress is ready for download.

The upgrade was easy enough and didn't break any of my plugins.

Apart from the new pretty dashboard-update, Wordpress 2.7 simplifies future upgrades by giving you the option of doing it for you. I'll have to wait till the next release to try it out.

wp27_upgrades

Download it here

Tagged as: No Comments
29Oct/082

Wordpress theme: Lounge-blur

I've started designing Wordpress themes, this is the first of a few on the way.

To download/preview the theme, click here:

It's a 2-column theme, with a horizontal navigation bar at the top and a simple side-bar on the right. It also has a subtle shadow around the box.

Let me know if you decide to use it or if you find issues with it.

28Oct/080

Performing Wordpress upgrades (Linux)

Note: Remember to always refer to the official upgrade guide. This is by no means official, but it has worked for me. I've tried to keep it as short and easy as possible.

Another Note: Wordpress 2.7 comes out on November 10th. It will have an automatic updater module - so you probably won't have to worry about this kind of thing again after that!

Versions tested with:

  • 2.6.3
  • 2.6.2
  • 2.6.1
  • 2.6.0

Obtain the path to your wordpress installation, we'll assume it's

1
/home/user/www/blog

Safety first. Always.

So make a backup of your Wordpress installation folder:

1
cp -rp /home/user/www/blog /home/user/www/blog.backup

Next, you'll want to make a backup of your MySQL database associated with it.

Refer to my Simple MySQL backup script to see how to do it.

You're good to go now - you'll be able to revert any changes you've made if you have to. (And that's a nice fuzzy feeling)

Let's get busy:

  • Make an update directory to copy new files from
  • Get latest Wordpress zip file
  • Unzip
1
2
3
4
mkdir /home/user/www/blog/update
cd /home/user/www/blog/update
wget http://wordpress.org/latest.zip
unzip latest.zip

Just to keep things clear, we have 2 directories at this point:

New files:

/home/user/www/blog/update/wordpress

Original files:

/home/user/www/blog

Delete your old wp-includes and wp-admin directories (I rename them here, which has the same effect).

1
2
3
4
5
mv wp-includes wp-includes.old
mv wp-admin wp-admin.old
 
mkdir wp-includes
mkdir wp-admin

Copy over the new files (NOTE that I haven't used the '-rp' flag for the last copy command):

1
2
3
4
5
cp -rp /home/user/www/blog/update/wordpress/wp-includes/* ./wp-includes/
cp -rp /home/user/www/blog/update/wordpress/wp-admin/* ./wp-admin/
 
cp -rp /home/user/www/blog/update/wordpress/wp-content/* ./wp-content/
cp /home/user/www/blog/update/wordpress/*.php ./

Log-in to your admin-page. If Wordpress needs to perform a database upgrade, it will do it for you.

Check that all your plugins are enabled and in proper working condition.

Optional: After you've tested everything and you're happy with the upgrade, you should delete all the extra files:

1
2
3
4
rm -r /home/user/www/blog/wp-includes.old/
rm -r /home/user/www/blog/wp-admin.old/
rm -r /home/user/www/blog/update/
rm -r /home/user/www/blog.backup/
15Mar/080

My top Wordpress plug-ins

After secretly messing around with Wordpress on one of my servers, I decided to move my blog to an instance of it permanently. Being a very flexible and extensible CMS, I've been researching some plug-ins for it. So far, I've come up with this list.

  • Akismet - helps block spam (and it's really good at it too). Needs an API key that's obtainable from Wordpress. Plus, it's free for personal use.
  • Maintenance mode - adds a maintenance splash page. When activated only authenticated users and admins will be able to browse the site.
  • Search meter - keeps track of what visitors are searching for
  • Feedburner Feedsmith - redirects all RSS and ATOM feeds to a feedburner RSS feed instead
  • Sociable - Adds links to Digg, De.li.cio.us, Stumble-upon and other sites for you
  • WP-Cache 2.0 - A really efficient page caching system and effectively makes your site faster and more responsive
  • WP-PageNavi - Adds a more advanced page navigation to the bottom of pages
  • Subscribe to Comments - Allows users to get e-mail notifications for any subsequent comments made
  • Smilies Themer - an easy way to change the default smilies pack
  • Google Analytics for Wordpress - You could just add the script, but this makes it easier.
  • WP-Syntax - Add syntax highlighting to code-snippets (supports many languages)
Page 1 of 11