• Resolved johnzoro

    (@johnzoro)


    You know you have the nav menu under the logo

    I know you can change it so it’s above the logo, but is there a way to keep it where it is, but add an additional menu above the logo?

    Possibly one where I can add a register/login link on?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    The hard way (but free) would be to add HTML to the theme using one of the hooks: https://generatepress.com/knowledgebase/hook-list/

    The easy way would be to use our Secondary Navigation add-on, which does it all for you.

    Let me know if you need more info ??

    Thread Starter johnzoro

    (@johnzoro)

    I’ve got a custom shortcode plug in

    This is my class

    .login_menu {
      background-color: #333333;
      font-size: 10px;
      color: #FFFFFF;
      padding: 5px 5px 5px 5px;
      text-align: right;
    }

    This is my code

    <div class="login_menu">
     <table>
      <tr>
       <td><?php wp_register(); ?> / <?php wp_loginout(); ?></td>
      </tr>
     </table>
    </div>

    Which has been shortcoded to

    [sc name="Top Menu Login"]

    So in my custom php I have

    add_action( 'generate_before_header','rlmenu' );
    function rlmenu()
    {
    
        echo do_shortcode( '[sc name="Top Menu Login"]' );
    
    }

    Will this work?

    Thread Starter johnzoro

    (@johnzoro)

    OK I tried that and it looks a bit fat, like i’ve added too much padding.

    Also the register and login/logout links I expected to appear aren’t appearing

    also it’s not right aligned.

    Thread Starter johnzoro

    (@johnzoro)

    i changed padding: 5px 5px 5px 5px; to padding: px 1px 1px 1px; but that hasn’t made any difference in the slightest?

    Theme Author Tom

    (@edge22)

    I wouldn’t suggest adding the table in there.

    Something like this might be better:

    <div class="login_menu">
        <span><?php wp_register(); ?> / <?php wp_loginout(); ?></span>
    </div>
    Thread Starter johnzoro

    (@johnzoro)

    Thanks tom that worked

    i don’t think my register and login links work however because nothing gets displayed

    Theme Author Tom

    (@edge22)

    Glad it worked.

    That might have something to do with how you set the shortcode up – make sure all the function names are right.

    Thread Starter johnzoro

    (@johnzoro)

    <div class="login_menu"><?php wp_register(); ?></div>

    This is what i have at the moment but it’s not displaying a register link?

    Thread Starter johnzoro

    (@johnzoro)

    https://codex.www.ads-software.com/Navigation_Menus

    Do I need to edit functions.php and add another menu in there?

    Theme Author Tom

    (@edge22)

    You could if you wanted to add a menu in there.

    As for the register link, make sure people are able to register, as it says at the top here: https://codex.www.ads-software.com/Function_Reference/wp_register

    The “Register” link is not offered if the Administration > Settings > General > Membership: Anyone can register box is not checked.

    Thread Starter johnzoro

    (@johnzoro)

    The anyone can register box is ticked.

    I only want to create a text link that says Register and a text link that says login. and then when you’ve logged in the login link changes to welcome john (logout) or whatever

    Thread Starter johnzoro

    (@johnzoro)

    add_action( 'generate_before_header','rlmenu' );
    function rlmenu()
    {
    	echo ' <span class="login_menu">';
    	wp_register('','');
    
    	if( is_user_logged_in() ) {
    		$current_user=wp_get_current_user();
    		echo 'Welcome ' . $current_user->user_login . ' (';
    		wp_loginout('');
    		echo ')';
    	} else {
    		wp_loginout('');
    	}
    	echo '</span> ';
    }

    This seems to work but the class only covers the register and login bits and not the whole area?

    Could it be cos i’m using span instead of divs?

    Theme Author Tom

    (@edge22)

    The class is only surrounding the register and login bits as far as I can tell?

    Thread Starter johnzoro

    (@johnzoro)

    yeah i fixed it by changing span to div

    Theme Author Tom

    (@edge22)

    Awesome ??

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Menu’ is closed to new replies.