Display Feedburner subscriber counts without chicklet

Ever wanted to display your subscriber counts from Feedburner, but didn’t want to use the “chicklet” they provide for that purpose? This PHP script will do the trick!

More »

Add widgetized areas to your WordPress site

This is a complete guide to adding a 4 column footer widget area to your site. The principles apply to adding widgets in in any area of your theme though.

More »

Put ad after first post on the page

Often there is a need to insert ad code (or other bit of content) directly after the first post on a page, but not after any others. You can do this by adding a counter and an if statement to the loop.

More »

Guide to creating custom WordPress loops

Learning to use custom loops is a must if you want to get beyond the basics in customizing themes for WordPress. This guide is clear and concise and even includes info about using the custom loop in the sidebar and in the Thesis theme, as well as creating a related posts section in your theme. (For the record, if I’m doing much with this kind of thing in the sidebar, I usually install Justin Tadlock’s Query Posts plugin which is seriously the most awesome plugin I know of.)

More »

Script plugin won’t run? Check the location of WP-Head

I don’t know much about JQuery and scripts in general, but I’m learning that the order they’re loaded in the header can make all the difference. If you have a plugin that uses the JQuery library and doesn’t come with it, then the hook for wp_head needs to be below the load of the JQuery library in the header. This is because often plugins use the wp_head function to insert script code into the header.

So, move this bit:

<?php wp_head(); ?>

lower in the header file just above the

</head>

tag.

More »

Resolve fatal memory error when upgrading WP

From time to time when I try to upgrade an installation of WordPress I get an error that starts “Fatal Error: Allowed memory size of 33554432 bytes exhausted…” This means that WordPress needs a certain amount of space allocated to perform the upgrade, and the server is not allowing it. There are multiple options to fix this. The easiest is option #3 in the linked article. If you get an error while trying to edit your wp-config.php file, you probably need to CHMOD the permissions on the file to allow you to write changes to it.

More »

Simple PHP if/then/else code

Very often in customizing themes, I run into the need for simple if/then/else logic. Maybe I want to display the author name only in certain categories, or I need a certain plugin to display output only on certain posts or pages, for example. Adding a quick bit of PHP makes these variable items very easy. Here’s the code:

 <?php if (in_category('67')) { ?>
     <p>Blue</p>
<?php } else { ?>
    <p>Red</p>
<?php } ?>  

In plain English, this code says: if the post is in category #67, display ‘Blue’, otherwise, display ‘Red’. I used a conditional tag for my if statement. You can read more about using WordPress conditional tags here.

More »

Load Random Stylesheets in WordPress

Need to have random color schemes for a site or maybe a random background image? Use this bit of PHP to load a random CSS stylesheet each time a user visits a site.

More »

Display custom fields in your theme

This is a simple bit of code that can save you a lot of time if you know you’ll have recurring items in each post. For example, the “read article” button in most of the posts on this site is done using a custom field called “link” within a div container called “link”. Here’s the code:

 <?php if(get_post_meta($post->ID, 'link', true)): ?>
<div class="link">
<h5><a href="<?php echo get_post_meta($post->ID, 'link', true); ?>">
Read Article</a></h5>
</div>
<?php endif; ?>

The code, in plain English, says: If there is a custom field in the post called link, then display the link button with the link in the custom field, using “Read Article” as the link text.

More »

Save space in the sidebar with DOMTabs

The more items you can get above the fold the better, and DOMTabs are a great solution for packing a lot of content in a small space.

More »

« Previous Entries Next Entries »