Category: WordPress Troubleshooting

Conditionally Show Only On Home Page (Front Page)

There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog). First – we had the function is_home(), but in WordPress version 2.5 – a new function was introduced: is_front_page().

You might think both would conditionally only display content on the home page (front page, page 1 of your blog) – but you actually need to use the following code to accomplish showing something ONLY on the front page of your paged blog:

<p>Show this text only on the home page</p>

So – if you want to easily show something on what I would consider the front page – use the code above to successfully achieve that. (This is particularly helpful if you have ads that run speficically on the home page and others that are ROS (run of site).

Further reading:

WordPress 2.5 Common Questions and Answers

After upgrading a number of sites to WordPress 2.5 – the questions are pouring in over the new user interface and the new functionality. I have compiled a list of the top questions I have received so far.

  1. I am getting weird PHP errors on my pages, what is going on? I have been busy with a lot of these issues and mostly from people who have updated to WordPress 2.5 but did not update any of their plugins at the same time. During the installation process – do not forget to grab the latest version of your plugins as well.
  2. My thumbnails are squished – how do I make them look better? WordPress 2.5 allows you to set the size of your thumbnails as well as gives you a “medium” size image option. By default, WordPress uses this option: Crop thumbnail to exact dimensions (normally thumbnails are proportional). If you upload images that are not square – this will really make your thumbnails look squished. I would recommend un-checking this option. (Settings > Miscellaneous)
  3. How do I turn on/off Gravatar support? This setting is located at the bottom of the discussion setting page (Settings > Discussion)
  4. How can I link my images to a page (attachment) like I did in 2.3? If you want to link your images to a page with a bigger version of the image within your page template, you can do so by selecting “Post URL” in the “Link URL” field when uploading an image with the new media uploader. There is also a new template for this page – image.php. You can find an example template in the default theme.
  5. My comments are not visible in the WordPress admin – what can I do to fix this? I have found this to be an issue on some sites with really outdated versions of WordPress. By executing: create index comment_date_gmt on wp_comments(comment_date_gmt); on the WP database – I have found that that usually clears it up. (Thanks to the WordPress forum thread on this)
  6. What all changed? If you want a great overview (with a video) check out the WordPress blog post on WordPress 2.5

Hopefully these answers will help you with getting more comfortable with WordPress 2.5. There are a lot of big and small changes to this new version of WordPress and every day I use it – I like it more (and hope you do too).

My Page Order WordPress Plugin Modifcation

I have been working with a client recently that was using the My Page Order plugin for the WordPress CMS I set up. They had several “draft” pages they used for templates and did not want them to show up in the My Page Order Admin interface. After looking at the SQL code, I added in a piece that would only show published (live) pages.
To make the same change in your code, open up the plugin file (mypageorder.php), go to line 47 and change the following line:

$results=$wpdb-&gt;get_results("SELECT * FROM $wpdb-&gt;posts WHERE post_parent = $parentID and post_type = 'page' ORDER BY menu_order ASC");


$results=$wpdb-&gt;get_results("SELECT * FROM $wpdb-&gt;posts WHERE post_parent = $parentID and post_type = 'page' and post_status='publish' ORDER BY menu_order ASC");

Now, only the pages you really want to order will appear in the menu.