WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hiding an element on all but one page with CSS (4 posts)

  1. cccoryy
    Member
    Posted 8 months ago #

    Right now, I have an image in my header that I only want to show up on one page.
    The image class is called IOTMonth and the page ID I want it to shop up on is 10717.

    Here is the only page I want it to show up on: Product page.

    I've read other posts about hiding certain elements on a single page but I couldn't find anything relating to this.

    Thanks in advance.

  2. BeardedGinger
    Member
    Posted 8 months ago #

    Hey,

    You should be able to accomplish this with most themes by adding the following css to your site:

    .IOTMonth {display:none;} body.10717 .IOTMonth {display:block;}

  3. cccoryy
    Member
    Posted 8 months ago #

    Thanks, it's almost working. It's hidden on all the pages but it's not showing up on the page I need it to. I've tried:

    body.10717 .IOTMonth {display:block;}

    and

    body.page-id-10717 .IOTMonth {display:block;}

    Any ideas?

  4. cccoryy
    Member
    Posted 8 months ago #

    I ended up doing:

    body.postid-10717 .IOTMonth {
    display:block;
    }

Reply

You must log in to post.

About this Topic