• Resolved mikelacroix

    (@mikelacroix)


    Hello!

    This is my header menu code:

    <ul class="menu">
    <li <?php if (is_home()) { echo 'class="selected"'; } ?>><a href="<?php echo get_option('home'); ?>/" title="Accueil">Accueil</a></li>
    
    <?php wp_list_categories('title_li=&orderby=order&exclude=1' . $ex_aside); ?>
    
    <?php wp_list_pages('title_li='); ?>
    
    <li class="cat-item cat-item=432"><a href="#acces">Accès client</a></li>
    
    </ul>

    I want the last option, the “Acces client” to show up only on the front page, and not on any of the category pages, or single post pages. Exclusively on the front page. And seeing I’m a completely php noob, I’m figuring someone has the magic trick for this one.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • try this

    <?php if ( is_front_page() ) { ?>
    <li class="cat-item cat-item=432"><a href="#acces">Accès client</a></li>
    <?php } ?>

    That assumes your front page is a static WordPress page. If your home page is a blog posts page you may have to replace is_front_page() with is_home()

    Thread Starter mikelacroix

    (@mikelacroix)

    Like a charm! Thanks!!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Header menu item to appear only home page’ is closed to new replies.