Forums

[resolved] Home Page Show / Hide Subnav Bar (4 posts)

  1. PopsiclePete
    Member
    Posted 3 years ago #

    Hello Everyone,

    I am working on a wordpress layout for a friend and I ran into a bump. This site is going to mimic a true static website so I've had to make some adjustments. I am using Parent and Sub pages to provide the basic content. The primary Navbar lists all the parent pages and the Subnav bar lists the 1st tier of sub pages.

    So here's the question: I don't have any subpages listed under Home. How can I hide the subnav bar when a visitor is looking at the Home page? Currently I'm seeing both bars and having an empty space looks funny to me.

    Big thanks in advance!

  2. stvwlf
    Member
    Posted 3 years ago #

    in header.php change your body tag to this

    <body<?php if (is_front_page()) echo ' class="home"';?>>

    Now you have added a class of "home" to the body tag when viewing the front page.

    In your CSS, if your Subnav is in a div called subnav, add this to the stylesheet:
    body.home #subnav { display: none; }

  3. PopsiclePete
    Member
    Posted 3 years ago #

    @ stvwlf

    Thank you for the note. I will give that a try this evening and see how it goes.

  4. PopsiclePete
    Member
    Posted 3 years ago #

    Worked like a charm. Thank you stwlf!

Topic Closed

This topic has been closed to new replies.

About this Topic