Category: WordPress

WordPress Logic: If Is Logged In

There are several tidbits of code that I have collected over the past few years that make it easier and easier to turn a simple WordPress installation into a very functional content management system (CMS). There are many times when it would be nice to show logged in members certain bits of information (certain categories, posts, or just a simple “Welcome back!”) and of course there is a simple way of doing this:

<?php if ( is_user_logged_in() ) echo 'Welcome back!';?>

That bit of code will allow you to do something like this which will allow you to show the logged in user’s preferred user name (selected in the User preferences), and then a list of member only pages (private page parent is page ID 20 – I am showing all sub pages of the members-only pages marked as private). If the user is not logged in, they will get a Welcome visitor! greeting :

if ( is_user_logged_in() ) :
  global $current_user;
  <p>Welcome back <?php echo esc_html( $current_user->display_name );?></p>
  <p>Here is a list of private pages only viewable by Members:</p>
  <?php wp_list_pages('post_status=publish,private&child_of=20');?>		
<?php else : ?>
  <p>Welcome, visitor!</p>
<?php endif;?>

You can make it as simple as a change in greeting for members and non-members, or put in specific logic like I did with showing the pages. The potential is limitless.

WordPress Update: 2.3.2

WordPress 2.3.2 has officially been released. The new version includes bug fixes and an urgent security fix. For more information on WordPress version 2.3.2, read the official WordPress version 2.3.2 documentation.
Download the latest versions of WordPress: WordPress 2.3.2

WordPress Plugin Update: Akismet

Today Automattic released an update to the Akismet. This is a great plugin to help with comment spam and has been priceless on all the sites I manage. If you are not using this plugin, you can use it for free for personal sites, or pay $500 for commercial sites. Check it out!

SDAC Recommends: WP Plugin: Top Level Categories

If you have ever wondered how to clean up WordPress URLs by removing the /category/ from your URLs, check out the plugin: Top Level Categories. After you activate it, you can access your web pages that were once only reachable by: /category/web-design/ by now using just /web-design/.

WordPress Update: 2.3.1

WordPress 2.3.1 has officially been released. The new version includes bug fixes and security fixes. For more information on WordPress version 2.3.1, read the official WordPress version 2.3.1 documentation.
Download the latest versions of WordPress: WordPress 2.3.1

Search Specific Category in WordPress

There are some times when you want to limit your search to a particular category, or perhaps multiple categories. This is relatively simple to do in WordPress by adding a hidden field to your search code. (See example below)

<form method="get" id="search form" action="/">
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="22" name="cat" id="scat" />
<input type="submit" id="search_submit" name="Search" value="Search"/>

You can see I added my hidden input field on the third line. When I add this in, it then adds onto the query used to search. Your search will go from something like to and will only return posts in the category ID you choose.

WordPress Update: 2.3

WordPress 2.3 has officially been released. The new version includes a number of new features – including tagging, update notification (for WordPress and WordPress plugins), advanced WYSIWYG features, out of the box search engine optimization, as well as other new features and fixes. For more information on WordPress version 2.3, read the official WordPress version 2.3 documentation.
Download the latest version of WordPress: WordPress 2.3

Updating From WordPress 2.2 to 2.3

I have been using WordPress for almost 4 years and have collected a number of database tables, plugin specific directories, and miscellaneous junk along the way on a number of my sites. I wanted to take some time and really do some spring cleaning. After a few hours – I was very pleased with the results and I wanted to share what worked for me.

Here are the steps I recommend to really clean out a WordPress installation:

  1. Make a backup of everything. You never know what you are going to get into – and a backup is very important incase things go bad.
  2. Make a test installation. I always use a test server when I know I am going to make several changes. This way, was not down while I was testing and cleaning up. With your backup files, import your database on the test server, and grab the latest version of WordPress (hopefully using subversion)
  3. Remove old or unused plugin database tables. I then went into the WordPress database and removed (dropped) any tables that were created by any of my old or unused plugins that were still hanging around.
  4. Weed out old, unused plugins. I went through my plugins and deleted any old or unused plugins. I had a few “I should really use this” plugins that were never used – and to tidy up – I deleted them before uploading them to the test server environment. Make sure to also remove any files/folders that old plugins might have used in the root folder and or wp-content.
  5. Move your theme over. Upload the theme file over to the test server.
  6. Move your uploads over/miscellaneous files. Upload the uploads folder (wp-content) so you will have all your old uploads.
  7. Update WordPress. Run through the upgrade process (/wp-admin/upgrade.php).
  8. Debug your plugins. Log in, create a test post to make sure you can write to the database without any errors. I ran into a few problems with this, so I deactivated my plugins and activated them one by one. I found I had a few plugins that were not compatible with WordPress 2.3, but there were updates available, so I updated my plugins and moved on.
  9. Import Tags (if you have them). I used Ultimate Tag Warrior and WordPress has an import option for that (Manage > Import) for that.
  10. Display your WordPress tags in your WordPress theme. Now that tagging is available within WordPress without any plugins, you can easily display tags by using: You can also use a tag cloud (see Codex documentation)
  11. Make another backup. I always make another backup of my sites when I am happy with the end result – just incase something happened – I would not lose all my hard work.
  12. Enjoy your updated installation. Hey – you did it! A clean, lean, updated web site. Nice work. Now go and enjoy it!

WordPress Update: 2.2.3

WordPress 2.2.3 has officially been released. The new version includes bug fixes and security fixes and WordPress users are recommended to patch their WordPress installation immediately. For more information on WordPress version 2.2.3, read the official WordPress version 2.2.3 documentation.
Download the latest versions of WordPress:WordPress 2.2.3