A number of people have asked for some detailed explanations of how to customize their category templates using Idealien Category Enhancements within their WordPress installation.
Over the next few weeks I’ll be putting out a series of 5-minute videos walking through the installation and template design process for different category styles. First up is one that everyone is probably familiar with – frequently asked questions. Code sample and step-by-step instructions are included below the video.
Direct Video Link:http://www.screencast.com/t/RrGumx6HhdY
Step-By-Step Instructions
- Download Idealien Category Enhancements from WordPress.org Plugin Directory.
- Upload the contents of the .zip to your wp-content/plugins folder.
- Activate the plugin.
- Copy a page.php file or any other existing template file from your current theme and save it as category_faq.php. (or whatever matches the category template prefix you define in the Settings > Idealien Cats menu. The rest of these instructions assume you are using category_ as the prefix).
- Go to the Posts > Categories menu to add / edit a category. At the bottom of the form make sure to select faq from the Template drop-down.
- Go to the Settings > Idealien Cats menu and copy the php comments at the top of the menu into your category_faq.php file, changing the appropriate fields. When you refresh the posts > categories menu it will now have the file title / description from the comments area.
Note: This does not affect the database table which stores entries based on the actual category template filename. - Modify your template file to use the two loops provided in the example code area below. The first one uses an unordered list of href links to show just the title. The second one has headings with anchor links followed by the post content for each post.
Example Code
Insert this code into your category_faq.php file within whatever standard xhtml / css markup is used to generate your primary content area.
<ul> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li> <a href="#post-<?php echo $post->ID; ?>" title="<?php the_title(); ?>"> <?php the_title(); ?> </a> </li> <?php endwhile; endif; ?> </ul> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h3><?php permalink_anchor('id'); ?><?php the_title(); ?></h3> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php endwhile; endif; ?>
12 Comments
I’ve installed ICE and followed the instructions in your video to set up a template, but the template does not appear in the Post Categories dropdown box. Any suggestions?
I found the problem. I’d put the template in the wrong theme. Everything is working beautifully. Thanks for the plug-in!
does this also provide flexibility for choosing to include side bar widgets or creating full pages?
The methods that standard category templates can use to include sidebar widgets are respected through this plugin. It does not have anything to do with pages though.
the newly create category (in my case Category_sales) doesn´t pick up the salessingle.php.
I want to create a series of landing pages (posts) that use another theme (a simple one without the sidebars, footers ect). I copied the single.php file from that theme (has more files like .css, index, etc), renamed it to singlesales.php and copied it to the standard theme directory where also the single.php file is.
In the new category (sales) I selected the singlesales.php theme, but when generating a new post in that category it still seems to pick the single.php (as I don´t see any changes in the resulting post layout ). Do I have to copy other files (like style.css, or index files and rename these as well)……??????
Any idea how to do this?
@her – From your description, I’d recommend you watch the video from this post which covers the steps you’re missing. You need to have a modified category selected through the posts > category menu applied to your category in order for a specific post template to take effect.
If you want non-category based post customization, you might want to try Nathan Rice’s Single Post Template Plugin.
Hi.
I have created custom template for certain category. When I step into that category, I can see changes there. But posts from that category on home page still look the same as other posts. Is that possible for those posts on main page also to have a custom look?
Thank you
No – for that you would have to modify the presentation in either home.php, index.php or the specific page template you have assigned to your home page within WordPress.
Awesome plugin! Working great, except for one little (and slightly annoying) glitch.
The plugin works wonderfully when I select a template while creating a new category, but doesn’t if I go into the “Edit” page of a pre-existing category. It allows me to select the template from the drop-down menu, but when I click save it doesn’t save it. This has lead me to having to re-create any of the categories I already had (including sub-categories) in order to get the templates to apply.
Any suggestions on how to fix this?
Thanks for the praise Sarah. Need more info to be able to offer any help to resolve your issue:
Hey, I would like to obtain something similar to what you have here: http://idealienstudios.com/projects/ice/
I don’t know if this is a category page, but what I need for my blog is to have a different explanatory text for to each category archive of my blog. Here you have the short text at the beginning ” Idealien Category Enhancements…” styled the same as the posts that follow it. Maybe this is not done with your plugin, but I’d appreciate a reply.
Thanks a lot.
It’s done with the category description field within a category.php template file.
Check out http://codex.wordpress.org/Function_Reference/category_description for examples.