Wordpress Mod: Showing Only Post Title on Category Pages
Sometimes, you may want to “compact” all your post in your Wordpress web blog by making the post title the only visible for all your posts. That is, the content will not be shown in the main page - only the title. See sample; http://www.jcmiras.net/wiki/category/electrical.
You can, actually, do that using the “<!–more–>” tool (just put the “<!–more–>” code to where you want to truncate your post). However, this could be a hassle and thus, you may want to make this automated.
Following is how we can make the post body invisible in all your blog entry. However, this is only effective for category and archive pages;
1. Open your ‘Theme’ folder located in /wp-content/themes/
2. Open your ‘index.php’ and ‘category.php’. If ‘category.php’ does not exist, create a new one.
3. Copy the entire content of ‘index.php’ to ‘category.php’.
4. In ‘category.php’, delete the following code:
<div class=”entrybody”>
< ?php the_content('Read the rest of this entry »'); ?>
</div>
5. Save ‘category.php’. You can further customize the ‘category page’ by modifying the code of ‘category.php’. ‘category.php’ is now, actually, your template for the ‘category page.
You can also do the same for ‘archive page’. For this case, you will have to create and modify an ‘archieve.php’ file.
Because of the hierarchy on how Wordpress looks for a template file, we’ll be able to change the ‘look’ of category page (and archive page). That is, WordPress looks for a generic category template file, category.php. If this file does not exist, WordPress looks for a generic archive template, archive.php. If it is missing as well, WordPress falls back on the main Theme template file, index.php.
Filed in: Wordpress
Local date: July, 2008












