Over a million developers have joined DZone.

Add Category RSS Feed Link

· Web Dev Zone

Learn why developers are gravitating towards Node and its ability to retain and leverage the skills of JavaScript developers and the ability to deliver projects faster than other languages can.  Brought to you in partnership with IBM.

 

When you have a WordPress site you can assign different posts to categories, this allows you to group your posts together.

For example on this site I have created categories for tutorials and snippets, so if people are looking to create a complete feature you can look in the tutorials category, but if you just want some useful coding tips you can just in the snippets section.

When you create a category you are then able to navigate to this category to view all the posts which are grouped in the category.

When you view a certain category WordPress will display this content using a number of files, which are displayed in the category hierarchy of:

  • category-slug.php
  • category-ID.php
  • category.php
  • archive.php
  • index.php

First WordPress will check to see if you have a file in your theme folder names category-{category-slug}.php, if this exists then it will use this to display your category content. If this doesn't exist then it will search for a file called category-{ID}.php, then category.php, then archive.php, the finally the index.php.

I normally create a category.php file to show the category content useless I want a certain category to look different than all the others.

Add A Category Feed For Certain Category


There maybe some categories which are more popular than others, for example you might have a freebie category where you post about free products on each post. This is a perfect candidate for someone to subscribe to just this category RSS feed.

Luckily in WordPress it will create an RSS feed for each category and they make it very easy to create a link to this RSS feed.

First open up your category.php file and add the following code to the top of your content.

<?php
     $category = get_category();
?>
<a href="<?php echo get_category_feed_link( $category[0]->cat_ID ); ?>">Subscribe to the <?php echo $category[0]->name; ?> category RSS feed</a>

Make the transition to Node.js if you are Java, PHP, Rails or .NET developer with these resources to help jumpstart your Node.js knowledge plus pick up some development tips.  Brought to you in partnership with IBM.

Topics:

Published at DZone with permission of Paul Underwood, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}