Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1074702
    strobley
    Participant

    Hi Themeco,

    I’m trying to add a custom function which holds a second copy of the X Primary menu after site end. I’m using this as a reference https://community.theme.co/kb/customization/actions-and-filters-in-x/

    A simplified version of the code is:

    function my_add_menu() {
    $x_navbar_class     = x_navbar_class();
    $x_get_view         = x_get_view( 'global', '_nav', 'primary' );
    
    echo '<div class="my-class">
    <div class="' . $x_navbar_class . 'my-other-class">'
    . $x_get_view . '
    </div>'
    }
    
    add_action( 'x_after_site_end', 'my_add_menu', 10 );

    The problem is when it renders in the browser the menu is output outside both of the containing divs ( <div class=”my-class”> and <div class=”my-other-class”> ). Both of the containing divs are empty, they do not contain the menu and it also outputs the word x-navbar as text.

    The result code output something like:

    <!-- END #top.site -->
    "x-navbar"
    <nav class="x-nav-wrap desktop" role="navigation">
    <ul id="primary-menu-2" class="x-nav">
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
    </ul>
    </nav>
    <div class="x-nav-wrap mobile">
    <ul id="primary-menu-3" class="x-nav">
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
    </ul>
    </div>
    
    <div class="my-class">
    <div class="my-other-class">
    </div>
    </div>
    

    I’ve searched and tried many modifications to the function code with no luck. May I ask how to write the function so the generated menu code is placed inside of the containing divs?

    Any wisdom much appreciated 🙂

    #1074721
    Christian
    Moderator

    Hey there,

    Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.

    Thank you for your understanding.

  • <script> jQuery(function($){ $("#no-reply-1074702 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>