Create a tag page on your WordPress blog

January 7, 2009

The problem of displaying tags in your sidebar is that it isn’t really readable, which caused many wordpress bloggers to get rid of tags. How to create a tage page to display your wordpress blog tags in a more readable manner? To create your tag page, the first thing to do is to create a page template. Paste the following code in it if you don’t know how to create one: <?php /* Template Name: Tags */ <h2>All tags</h2> wp_tag_cloud('number=0'); ?> That’s simple as that! The number=0 parameter specifies... [Read the full story]

Create a Logout button on your WordPress blog

January 6, 2009

Especially in the case of a multi-author blog, it can be really useful to include a logout link on your theme. To create a “Logout” link on your WordPress blog, simply paste the following code on your theme: <a href="<?php echo wp_logout_url(); ?>">Logout</a> Please note that this will work with WordPress 2.7+ only. If you haven’t switched to WP 2.7 yet, the following code will do (almost) the same job: <a href="/wp-login.php?action=logout">logout</a>  Read More →

Get the list of wordpress post that have no tags yet

January 5, 2009

If you ever wanted to get a list of your wordpress blog posts that have no tags yet, here’s a nice recipe for you, where we will show you how to easily create a custom loop and check out if your wordpress posts have tags or not. To get the list of un-tagged wordpress posts, simply paste this custom loop anywhere or your wordpress theme, or use a page template. This loop will only show posts that haven’t been tagged yet. <?php query_posts('orderby=title&order=asc&showposts=-1'); ?> <?php if (have_posts())... [Read the full story]

Get a particular header, footer, or sidebar of wordpress

January 4, 2009

Since WordPress 2.7, it is easier to choose which header, footer or sidebar file you want to include on your theme. The following code will check if the reader is on the “WordPress” category. If yes, header-wordpress.php will be inclued, otherwise the default header will be used: <?php if is_category('WordPress') { get_header('wordpress'); } else { get_header(); } ?> You can also use that new functionality with footers and sidebars: <?php get_footer('myfooter'); ?> will include footer-myfooter.php <?php... [Read the full story]

Display the most commented posts of one year

January 4, 2009

To get started with new year, what about displaying a list of the 10 most commented posts of 2008 to your readers? That’s obviously a great way to give a second life to your old posts. To display a list of your 10 most commented posts from 2008, simply paste the following code on your blog sidebar, or anywhere on your theme:   <h2>Most commented posts from 2008</h2> <ul> <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title, post_date FROM $wpdb->posts WHERE post_date... [Read the full story]