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:
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.
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.
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
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>
0 comments:
Post a Comment