Provide a rss feed per category to your wordpress readers
November 23, 2008
Do you blog about a lot of different topics? If yes, you may want to provide a rss feed per category, so your readers will be able to only read what interests them. Believe it or not, this is very easy to achieve. This recipe is probably one of the easiest to achieve I have ever published, but it is very useful. Let’s say you’d like to be able to only suscribe to Live experience wordpress tips. The category url is: http://www.livexp.net/windows/wordpress To get a rss feed, you simply have to add /feed at the end of the... [Read the full story]
Display WordPress Categories without Children
November 22, 2008
If you are displaying your categories somewhere and would like to remove the children, here is the code you’ll need (for WordPress 2.5+): The depth=1 is the important one for the purpose of this hack as it is what tells WordPress not to display more than your parent categories. By default, it is of course set to depth=0 (shows all categories). If you are wondering what other options you have, here is what the WordPress Codex lists for the depth parameter: 0 - All Categories and child Categories (Default). -1... [Read the full story]
Tips of WordPress Categories
November 18, 2008
Outside the common use of category tags in WordPress templates, there are very useful functions that can be very powerful and can help you achieve many different things with categories. Tip 1: Get Category name by its ID You could use the following snippet to get category name by its ID. <?php $catname = get_cat_name(1); print $catname; // Would print the category name for category ID 1 ?> Tip 2: Get Category ID by its name You could use something like this. <?php $catid = get_cat_ID('Videos'); echo $catid; //... [Read the full story]
Displaying Wordpress Category RSS Feed Link
November 15, 2008
Here is the function that controls the feed link of category as globally set by WordPress: <?php get_category_feed_link($cat_id,$feed) ?> Basically it returns the category feed link. $cat_id is the category id. $feed should be replaced with feed name. Most probably you can use something like this: <?php get_category_feed_link('14',''); ?> That function tells wordpress to return feed link for category with ID 14 and default feed name RSS 2. Ok that is good progress. But it will not print the results to browser... [Read the full story]
Use different single template per wordpress category
November 11, 2008
Why a blog must always have the same layout? I’m going to tell you how you can define differents post layouts for each of your categories. First, you’ll have to create each different layouts you’d like to use. They’re named single1.php and single2.php. The default posts template is single_default.php. Once you have your templates ready, insert the following code on your regular single.php file. When single.php will be called, this code will automatically include your custom layout based on the current category id. <?php ... [Read the full story]




















