I need to hide the name in the category box from a specific page. I need to show the name in all other pages but this one.
Is there a way to use this CSS for a specific category? Thank you!
.box-text-inner {
display: none;
}
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Let’s assume you have a custom page with the name/title “Hello”.
and add the following code to your themes functions.php or you can also create your own plugin.
Code snippet:
function my_custom_page_category_hide(){
$page_title = $wp_query->post->post_title;
if($page_title=="Hello"){
echo '<style>
.box-text-inner { display: none !important; }
</style>';
}
}
add_action( 'wp_head', 'my_custom_page_category_hide' );
Just paste the above code and do check the priority of your custom css code.
In case of any issues let me know in the comment.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0