Treehouse: Grow your CSS skills. Land your dream job.

Simple php problem

  • # January 21, 2011 at 3:21 am

    I’m embarrassed that I can’t figure this out on my own, but I don’t have a php background. I have a code block in wordpress to put in the submenu in the header depending on the parent page, but I don’t want it on the home-page. How would I code it to not show a sub-menu on the home page? Or any other particular page, for that matter?

    # January 21, 2011 at 3:39 am

    Try this. You can just say if is_page then the page number. So basically you are only showing the submenu on certain pages. The last else statement just puts your main menu on all other pages.

    # January 21, 2011 at 5:53 pm

    Thanks, but what I’m trying to write is a statement that doesn’t default to a sub-menu, I want the default to return nothing.

    # January 21, 2011 at 6:13 pm

    then that would be

    # January 22, 2011 at 2:27 am

    That didn’t work, but I figured it out. The last line before closing tag:

    //no sub menu displayed
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.