Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #720435

    mthomas91
    Participant

    Hi,

    Sorry, how do I add a class to the menu items?

    Thanks,
    Miles

    #720536

    Jade
    Moderator

    Hi Miles,

    Please see screenshot for guide.

    Hope this helps.

    #763275

    nphough
    Participant

    Hello – I just came across this as I was looking for the same info about creating a top bar menu. This works well and thank you for continuing to update it!

    My question is: if I create nested menu sub-items in top-menu they are displaying all the time instead of just on mouse over. Is there a way to make these items drop down on mouseover like in the regular menu? Thank you!

    #763670

    Friech
    Moderator

    Hi There,

    Thanks for writing in! Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding. Take care!

    #791851

    pbeauchemin
    Participant

    Hi There,

    I implemented the code on the first page of this thread and created a page called “_topbar.php”.

    Can you please tell me how I get the nav in the topbar to be right justified with the main nav?

    Thanks

    #792424

    Lely
    Moderator

    Hi There,

    To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #887181

    CodetrixNZ
    Participant

    Hi Team,
    I’ve read through this thread and it’s been exactly what I was after thank you, great detailed replies!
    In my new Topbar Menu I’d like to have a Login/Logout link that dynamically changes depending if the user is logged into their account or not.
    Is that possible?
    Cheers

    #887639

    Rue Nel
    Moderator

    Hey @codetrixnz,

    Thanks for updating this thread!

    In my new Topbar Menu Iโ€™d like to have a Login/Logout link that dynamically changes depending if the user is logged into their account or not.
    Is that possible?

    Yes it is possible. And since what you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that wonโ€™t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Once you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.

    // Add Login/Logout link shortcode
    // =============================================================================
    add_shortcode( 'wp_loginout', 'wp_loginout' );
    
    // Allow shortcodes in the topbar content
    // =============================================================================
    function allow_custom_shortcodes($contents) {
      $contents = do_shortcode($contents);
      return $contents;
    }
    add_filter('x_option_x_topbar_content', 'allow_custom_shortcodes');
    // =============================================================================

    And then, please go to your customizer, Appearance > Customize > Header > Miscellaneous and turn ON the topbar content. You can then insert this shortcode: [wp_loginout]

    I would loved to know if this has work for you. Thank you.

    #890872

    CodetrixNZ
    Participant

    Bingo! That was exactly what I was after thank you very much!

    #891567

    Zeshan
    Member

    You’re most welcome! ๐Ÿ™‚

    #892414

    hipneck
    Participant

    Thanks to the code in this thread, I was able to add a WooCommerce Topbar Menu to Integrity. Yay, me! ๐Ÿ™‚

    I created the WooCommerce account & dynamic login/logout links using WooCommerce Menu Extension (available at WordPress.org). I think WooCommerce has basic page links you can add to your menu but I’m not sure that they’re dynamic based on login status (haven’t checked).

    Thanks guys for all your support!

    #893017

    John Ezra
    Member

    Youโ€™re most welcome! ๐Ÿ™‚

    #1005890

    michaellanfield
    Participant
    This reply has been marked as private.
    #1006267

    Friech
    Moderator

    Hi There,

    You can write the menu in HTML and paste it on the Topbar Content.

    <ul class="custom-menu">
    	<li><a href="#">menu1</a></li>
    	<li><a href="#">menu2</a></li>
    	<li><a href="#">menu3</a></li>
    	<li><a href="#">menu4</a></li>
    	<li><a href="#">menu5</a></li>
    </ul>

    And then a custom css to float it on the right.

    ul.custom-menu {float: right;}
    ul.custom-menu li {
        display: inline-block;
        padding: 0 8px;
    }

    Hope it helps, Cheers!

    #1006505

    michaellanfield
    Participant

    Thank you it worked, but is there a way to create a menu with sub menu?