Insert menu php

Homepage Community Forums Epik Theme Support Insert menu php

Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3868
    ggsalas
    Customer

      Hi, i need a code to insert a menu in “header right widget”, because the code I have not show styles well:

      wp_nav_menu( array( ‘menu’ => $menu, ‘container_class’ => ‘menu-base-container’, ‘theme_location’ => ‘primary’ ) );

      Thanks.

      #3870
      Terence
      Customer

        What’s wrong with using the “custom menu widget”?

        #3871
        ggsalas
        Customer

          SocialStrategy,

          Nothing is wrong, but I need modify the menú for not-logued-in users, and with a hook I can do it:


          if( is_user_logged_in() ) {
          $menu = 'logged-in';
          } else {
          $menu = 'logged-out';
          }

          #3872
          Terence
          Customer

            You can also do it, much easier, and still using the custom menu widget, if you use the “If Menu” plugin ~ which is getting a little old but still seems to work OK.

            Your choice.

            #3874
            ggsalas
            Customer

              @SocialStrategy the plugin is perfect, but my goal is to show a login form to not logged users, i post my code complete:

              if( is_user_logged_in() ) {
              $menu = 'base';
              wp_nav_menu( $defaults ); wp_nav_menu( array( 'menu' => $menu,

              'theme_location' => '',
              'menu' => '',
              'container' => 'div',
              'container_class' => 'menu-base-container',
              'container_id' => '',
              'menu_class' => 'menu',
              'menu_id' => '',
              'echo' => true,
              'fallback_cb' => 'wp_page_menu',
              'before' => '',
              'after' => '',
              'link_before' => '',
              'link_after' => '',
              'items_wrap' => '%3$s',
              'depth' => 0,
              'walker' => ''
              )
              );

              } else {

              <form name="loginform" id="loginform" action="/wp-login.php" method="post">
              Remember Me?

              <input name="redirect_to" value="/wp-admin/" type="hidden">

              }

              #3875
              Terence
              Customer

                Then all you have to do ~ with this plugin installed and activated ~  is select “Enable Conditional Logic” on the menu item, and then use the drop down to select [Hide] if [User is logged in].

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.