you would have to make a conditional logic function something like
if(is_category(id1,id2, id3)
{
hide info
}
Assuming I knew the category ID (which I know how to find), what file would I enter that code into? If it’s just one category and not all pages/posts…
Also, when you write “hide info”, what actually goes in between the {} in that example? Like, “entry-author” ? I’m a bit confused.
Thank you so much for trying to help me, you’re a true lifesaver.
How should I proceed?
it will go into your functions.php file (preference would be if you create a child theme and not modify the core files)
i usually do for hide info thing is use css
<?php
if (is_category(‘id’))
{
echo ‘ <style> #author {display:none;} #time {display:none;}
</style>’;
}
?>
Thank you Robin, I will try that code and mess around with it. If this works, I’ll hurry back and let you know that you saved the day.
I wish I was a guru like so many people here are 🙂
Thanks again,
Ben
Hmm…is there a particular location in the functions file that this code should go in? Like, between other code, or at the very end, or etc.
Thank you!
Well, no matter where I seem to place it in the php file, I get this sort of error:
Parse error: syntax error, unexpected ‘<‘
I’m copying your code exactly, so perhaps I’m putting it in the middle of some code I should not be breaking up?
Is there a surefire way to know where I can put it where it will be safe and work correctly?
Thank you!
my code was just a reference guide
and if you are getting this error means you are not closing your tags properly or missing a bracket
and if you put it on top under your
<?php ?>
it should not break
Ah, yes ok – I thought I maybe forgot to close off the PHP with ?> or something – but it looked right.
I’ll try and put it at the top under the <?php ?> – thanks again!
<?php
if ( is_user_logged_in() )
{
echo ' <style>
</style>';
} else {
echo ' <style>
html {
background-color:#FFF !important;
}
</style>' ;
}
?>
this is my working code
i mean if you follow the structure of my code it should work , as this is the code i am using in one of my sites
Ah, yes – good news. The code no longer has a syntax error, but it doesn’t hide any data – so maybe the CSS does not match?
if (is_category(’23’))
{
echo ‘ <style> #author {display:none;} #time {display:none;}
</style>’;
This doesn’t return an error but the author and time are still showing up in that category for posts.
Hmmm…any ideas? You seriously are saving my tail here…