Identify if it is blog and hide div - Wordpress

Asked

Viewed 99 times

0

I put a div called "imagem_top" and I want it to have the property display: none when it’s the blog page, Woocommerce product or post. I’ve tried to put in functions.php, header.php, page.php and nothing works. What I’m doing wrong and where should I put the code?

Follows function:

function hidediv() {
if(is front_page() && is_home() || is_single() || is_product() ) {
        document.getElementsById("imagem_topo").style.display='none';
}
  • Hi, [Emerson][1]. As you are mixing Javascript with PHP, I assume you don’t have much intimacy with both and offend , I have two questions: 1) Are you layman or can I delve into some points of PHP if necessary? 2) Which theme you are using, you can edit its CSS?

  • So I thought of the code below:

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.