banner

category0101

How to add a Category Title in your Wordpress Blog:

 

It’s been a month since I open the section “Coding Support” and glad that I am receiving a lot of queries directly to my inbox using this form. And the most popular question is about their ‘Category Templates’. Here are the sample queries.

 

Questions via nazcarpine.com/#coding-support:

 

I have this category.php file in my Wordpress theme, when they click certain category, the list of post under this category will be listed but the category title does not show up. How will I add the category title in my Category template?

 

Here’s a quick solution for your query:

 

  1. Open the category.php of your template blog-url/wp-admin/theme-editor.php
  2. Find the code (or similar):
    <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
    
  3. This is the start of the post loop.

     

  4. Add the following code BEFORE the mentioned code above:
  5. 
    Category: <?php single_cat_title(); ?>
    

 

DONE! The process above will display the category name above the posts under the said category. If you want to display the category name in your sidebar, header or any desired place in your template. You can do it so.

 

You can also tweak the style of this line by adding heading tags between the given code: <h1>, <h2>, <h3>, <h4>, <strong>, <div> and so on

 

Sample Output:


<h1>Category: <?php single_cat_title(); ?></h1>

 

How to add a Category Title & Description in your Wordpress Blog

How to add Category Name and its description in my Wordpress category template when my visitors are viewing the post under Category mode?

 

If you want the Category description to be displayed, here’s the piece of code you will need.


<?php echo category_description(); ?>

 

You can paste this code below the title as discussed above.


<h1>Category: <?php single_cat_title(); ?></h1>
<?php echo category_description(); ?>

 

This code will display the Category name and the category description.


Buy Me a coffee

If you like this post/tutorial...

You can buy me a coffee and help maintain N-Designs.
This entry was posted on Thursday, November 5th, 2009 and is filed under Site Updates by Nazcar Pine.
Tags: , ,
Advertise Here

Leave a comment

Subscribe

Enter your email address:

Delivered by FeedBurner

Nazcar Pine
Welcome to N-Designs. I am Nazcar Pine (naz), a freelance website designer and developer, graphics designer, and a blogger. Need a website? Send me a message for a quote. Thank you
Advertise HereAdvertise HereAdvertise Here
Advertise HereAdvertise HereAdvertise Here

Website Design

Graphics Design

UI Designs

Advertising

Website Hosting

SEO

US STORE

No featured item

Japan STORE

No featured item
Advertise Here

RANDOM PHOTOS

sunset0007.jpg samurai-jack.jpg beach.jpg Avatar movie wallpapers Mexico - seamless-weaves-17.png beach3.jpg building-infrastructures01.jpg
 336 x 280 Advertisement Here

CONTACT ME

SKYPE: u.nazcar

YM: nazkhie