WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Alternate menu (php IF statement) help (3 posts)

  1. Wpaul63
    Member
    Posted 3 years ago #

    I've installed the splashgate plugin in order to create a disclaimer page that the user must access before gaining access to the sensitive information. This also means hiding the main nav menu until the user has agreed to the disclaimer / TOS.
    The "if" statement should be quite straightforward but I keep on geting a "unexpected T_IF" error on line 86 (where I test for the page ID). i know the error must be glaring, but I can't find it...
    Can anyone point me into the right direction?

    <? php
    				if ( is_page('35547')
    				{php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'vuoto' ) );
    				}
    				else if
    				{php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );
    				}
    				endif;
    				 ?>

    Thx

    Paul

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    general syntax problems -
    a broken php start tag; brackets in the if statement; php fragments inside the { ; else if instead of else; (false endif in connection with } syntax (unless the endif is part of an unposted section of the code ?);

    hopefully corrected below:

    <?php
    				if ( is_page('35547') )
    				{ wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'vuoto' ) );
    				}
    				else
    				{ wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );
    				}
    ?>
  3. Wpaul63
    Member
    Posted 3 years ago #

    Thank you it worked - a round of applause and a beer if you ever visit southern Switzerland :-)

    Paul

Topic Closed

This topic has been closed to new replies.

About this Topic