Separating Comments and Trackbacks

One thing I don’t love about WordPress, is its way of including comments, pingbacks, and trackbacks all in one list, and doesn’t provide an easy option to separate them. Separating these gives your comments area a cleaner, more professional feel. Here’s how to do it:

Read more…

Stylesheet Directory Link Tag

One difficulty of designing WordPress themes you plan to let others use, is linking to images within the template directory (where the stylesheet is). Fortunately, WordPress provides a tag for doing just that.

<?php echo(get_bloginfo('template_directory')); ?>

/images/ is the images folder inside your theme folder. You can link to a page in that folder (comments.php) or something inside the images folder:

<img src="<?php echo(get_bloginfo('template_directory')); ?>/images/rss_icon.gif" alt="" />

We can make linking to an image even easier:

<?php
$bloginfo_link = get_bloginfo('template_directory');
$image_link = $bloginfo_link . '/images';
?>

<img src="<?php echo $image_link; ?>/rss_icon.gif" alt="" />

We assign the template directory path to the variable $bloginfo_link and then put the directory path and the image folder path together.

The easiest way to display ‘Home’ as a navigation link, Period.

Here is the easiest way to display a homepage link in the navigation bar of your WordPress site. I can guarantee that you won’t find an easier way out there.

The code:

<ul>
<li<?php if ( is_home() ) { ?> class="current_page_item"<? } ?>><a href="<?php get_option('home'); ?>">Home</a></li>
<?php wp_list_pages('title_li='); ?>
</ul>

It’s pretty obvious how this code works. If the current page is the blog’s homepage, then it’ll add a special class to the list item to mark it as the current page. If it isn’t, the navigation button displays normally.

That’s it. No extra pages, no special configuration. The easiest way to display ‘Home‘ as a navigation link, period.

Setup WordPress Locally On Mac OS X

When designing WordPress themes, it’s nice to be able to store them locally to test them instead of uploading files to a web server (though Transmit makes it quite easy). In this tutorial, you’ll learn how to set up WordPress locally on your Mac and then manage multiple blogs with their own themes.

Read more…

Tutorial: Content For Admin Only

For a couple of days now, I’ve being wondering how to display something only for the admin to see, when the admin is logged in. This could come in handy to display links to the WP admin panel or stats page.

So I did a bit of research and I found exactly what I was looking for:

<?php global $user_ID; if( $user_ID ) : ?>
<?php if( current_user_can('level_10') ) : ?>

Stats

<?php else : ?>
<?php endif; ?>
<?php endif; ?>

The code above will display “Stats” with a link to a stats page, but only for the admin, when the admin is logged on.

You can modify the code above to display links only for certain types of users, such as Contributors, Authors, Editors, etc, by changing the “level_10“. Read more about WordPress Roles and Capabilities here.

This is just a quick little tutorial I wanted to share with you guys! Enjoy. Oh and if you know of any other ways to use this tutorial, please share!

Hardcode Social Bookmarking Links

Social Bookmarking is now well and truly integrated into Blogging/Web 2.0 culture. We rely on it now more than we need it. How many of us use Digg, del.icio.us or any of the other hundreds of Social Bookmarking sites? The benefits for bloggers are enormous, generating extra traffic through free advertising, and for the everyday user, a quick access to interesting and useful content. In a fairly recent post, WPCandy discussed what Social Networking and Bookmarking was, as well as mentioned some of the popular Social Bookmarking plugins for WordPress.

Read more…

4 Simple Ways To Speed Up WordPress

Some self-hosted WordPress sites tend to run slow, especially when you receive tons of heavy traffic every day. This may be a result of the amount of large files your site needs to load or inefficient coding. But there’s nothing worst than a slow site, so here are some quick tips on how to speed up your self-hosted WordPress site. These tips mostly apply to self-hosted WordPress site because if you’re site is hosted on WordPress.com, you’re already being taken care of.

Read more…

The Advanced WordPress Help Sheet

About a month ago, WPCandy released The WordPress Help Sheet, a PDF packed with PHP snippets, the basic template files, and other extra stuff for WordPress. It became pretty popular around the Blogosphere within a couple of days and was translated into quite a few languages. The WordPress Help Sheet was a great success and allowed WPCandy to become known to the rest of the world.

The WordPress Help Sheet was a good WordPress resource, but it was pretty limited and only had the basics of WordPress. I kept thinking to my self, “What about more advanced WordPress developers? They need something too!”. I felt they were being left out of all the fun. So here’s something for all you WordPress gurus…

Read more…