0

For a long time I was trying to figure out how to add category descriptions to not only the top of the category pages, but also to the bottom as well. There seemed to be no solution to this (absent me learning to code and becoming more clever), so I opted for a somewhat crude option.

Since I turned off auto updates for my theme, I decided to just shove my category descriptions into the bottom of the category.php theme file. This works fine EXCEPT for the fact that it adds that description to all category pages.

So, what I am wondering is: Is there a way to constrain the text I've added to my category.php file to only a specific category page? Something along the lines of displaying that text only if its a certain category-id# or something like that

1 Answer 1

0

Wrap it up! Err, in a conditional statement that is.

if ( is_category( 'My Category' ) ) {
    echo '<p>' . category_description() . '</p>';
}

That is just a crude example, though. We would need to see your code to give a definitive answer.

Reference: https://developer.wordpress.org/reference/functions/is_category/

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.