Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to add the text to top of each category page. I am using a plugin http://wordpress.org/extend/plugins/categorycustomfields/ . With the help of this plugin, i am able to add extra field to my categories, but how can i display that. eg :- if i want to display category description, i used <?php echo category_description(); ?> similarly, how can i display custom field value.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

May I suggest using one plugin that I use for my sites ( I am a web-developer)? I Use Extra category content plugin (http://www.greatwpplugins.com/extra-category-content/) if I want to put any kind of content (text, image, link, etc) before the post listing in a category. Just install the plugin, edit a category to add some extra content and add in the template the code <?php echo the_extra_category_content( ); ?>.

share|improve this answer
add comment

In the admin there's a description textarea for adding some extra text to each category. In your template file you can show this text via the category_description($cat_id) function.

Alternatively, you could also use the is_category($cat_id) function to check whether a certain category is being displayed and then do whatever you want in there.

if (is_category(5))
{
  // Description for the current category
  echo category_description();
  // Add some extra content
  echo 'This is category number five, yay!';
}

Note that you can use the category template files as well:

category-$slug.php > category-$id.php > category.php

share|improve this answer
    
Thanx, actually i was in need of extra field. I used the category custom field plugin. but the problem is how can i display that. –  user930026 Dec 12 '11 at 9:15
    
For eg if i want to display description , i use <?php echo category_description(); ?>, similarly, not getting, how to display custom field –  user930026 Dec 12 '11 at 9:23
    
I don't understand what you're saying. Please, update the original question with extra information. –  Geert Dec 12 '11 at 10:18
    
Hi, i have edited my qustn –  user930026 Dec 12 '11 at 10:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.