1

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.

2 Answers 2

0

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( ); ?>.

1

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

4
  • 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, 2011 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, 2011 at 9:23
  • I don't understand what you're saying. Please, update the original question with extra information.
    – Geert
    Dec 12, 2011 at 10:18
  • Hi, i have edited my qustn
    – user930026
    Dec 12, 2011 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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