I've read a lot of information about this but haven't found an answer. For one particular category, I need to hide the author meta information. Is there a conditional statement that can help with this?
Thanks,
Bob
I've read a lot of information about this but haven't found an answer. For one particular category, I need to hide the author meta information. Is there a conditional statement that can help with this?
Thanks,
Bob
You should be able to wrap the meta code with:
<?php if (is_category('category-slug')) { ?>
(Your Meta Code Here)
<?php } ?>Thanks deepbevel the code makes sense but didn't work. It was hiding everything.
I'm wondering if I should use category IDs instead?
So if I have a category 'dogs','cats', and 'other' do you have any ideas?
Thanks,
Bob
Is this for single.php or an archive/category template?
try using "in" category instead of "is".
thanks for your reply. it's a single.php template. i actually figured out another way. I added this code at the top of my single.php file
<?php
if(in_category(xx)) {
// Custom Template for Single Posts in Category xx
include 'template-xx.php';
} else {
?>
Then I created a duplicate single.php template without the extra php code and called it template-xx.php, added reference for a custom header that used a custom style sheet, and set the meta code to display:none.
It was more work than I wanted to do, but I couldn't figure out another way.
thanks again for your help.
Good solution.
That's why the conditional didn't work. "Is category" is for archives.
It's probably just as well, in case you want to do more customizing later. Too many conditionals gets confusing fast.
You must log in to post.