Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1405098

    Hello,
    I am using the secondary menu for navigation. Our designer has created a layout with the home and about pages floating to the left and the rest of the menu floats to the right. Is there a way to do this and have the screen stay responsive for smaller screens?
    Design:
    http://learning3dev.wpengine.com/wp-content/uploads/2023/04/Landing-Page.png(hosted on WPengine) />
    Please let me know if there is a way to position the first two menu links on one side of the screen and the rest on the other.
    Thanks,
    Guy

    #1405195

    Hi Guy,

    The image link you gave doesn’t seem to display the image, please check.

    Best regards,
    Nikko

    #1405197

    (hosted on WPengine) alt="site design home page" />

    Sorry, I’ve fixed this.

    #1405281

    Hi,
    Thank you for your patience, to have two split topbar menus we will use the Secondary Menu in the topbar at the left and create a shortcode for a menu in the Header Phone Number/Extra Info in the topbar at the right.
    This is the expected result:
    Enfold_Support_1855.jpeg
    To create the shortcode for the menu I adjusted the function in this article, add this code to the end of your child theme functions.php file in Appearance ▸ Editor, or if you are not using a child theme I recommend the WPcode plugin this plugin supports PHP code snippets, JavaScript code snippets, & CSS code snippets and allows you to export and import your custom code snippets to other sites that you may have or as a backup. If you use WPcode plugin this is a PHP snippet.

    function list_menu($atts, $content = null) {
    	extract(shortcode_atts(array(  
    		'menu'            => '', 
    		'container'       => 'nav', 
    		'container_class' => 'sub_menu alignright', 
    		'container_id'    => '', 
    		'menu_class'      => 'menu', 
    		'menu_id'         => '',
    		'echo'            => true,
    		'fallback_cb'     => 'wp_page_menu',
    		'before'          => '',
    		'after'           => '',
    		'link_before'     => '',
    		'link_after'      => '',
    		'depth'           => 0,
    		'walker'          => '',
    		'theme_location'  => ''), 
    		$atts));
     
     
    	return wp_nav_menu( array( 
    		'menu'            => $menu, 
    		'container'       => $container, 
    		'container_class' => $container_class, 
    		'container_id'    => $container_id, 
    		'menu_class'      => $menu_class, 
    		'menu_id'         => $menu_id,
    		'echo'            => false,
    		'fallback_cb'     => $fallback_cb,
    		'before'          => $before,
    		'after'           => $after,
    		'link_before'     => $link_before,
    		'link_after'      => $link_after,
    		'depth'           => $depth,
    		'walker'          => $walker,
    		'theme_location'  => $theme_location));
    }
    add_shortcode("listmenu", "list_menu");

    Then the shortcode will be like this: [listmenu menu=37] to find the menu ID number for your shortcode go to your menus and hover over the “Delete Menu” link and look in the browser link inspector popup:
    Enfold_Support_1857.jpeg
    Then add the shortcode in Enfold Theme Options ▸ Header ▸ Extra Elements ▸ Phone Number or small info text with the option set to show the element on the right:
    Enfold_Support_1859.jpeg
    Now the last step is to remove the two div’s in the phone info topbar div for the menu shortcode, these divs are added for the typical text that is added to the Enfold Theme Options ▸ Header ▸ Extra Elements ▸ Phone Number or small info text field, but we want to remove them for our menu.
    Add this code to the end of your child theme functions.php file in Appearance ▸ Editor, or as a PHP snippet in the WPcode plugin:

    function remove_phone_info_div_for_topbar_menu_shortcode() { ?>
      <script>
    window.addEventListener('DOMContentLoaded', function() {
    (function($){
      $('.phone-info.with_nav div').contents().unwrap();
      $('.phone-info.with_nav').contents().unwrap().css({'margin':'0'});
    })(jQuery);
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'remove_phone_info_div_for_topbar_menu_shortcode');

    Now the two menus in the topbar will float right and left responsively for desktop and tablet:
    Enfold_Support_1861.jpeg
    for mobile they will stack since there is not enough room:
    Enfold_Support_1863.jpeg
    Please ensure to copy the codes from the forum and not an email notification so the symbols are not converted.

    Best regards,
    Mike

    #1405518

    Hi Mike,
    Thanks a lot for your help and the great instructions. I have this working on our dev site. See the link below.

    I have another question. Let me know if you’d like me to open another thread.

    I need to have the word “Search” appear next to the magnifying glass and be clickable. I am able to add the word next to the icon but am not sure how to make it clickable.

    Here is what I’m doing in the CSS:

    #header_meta .sub_menu #menu-item-search::after {
    content: “Search”;
    font-size: 16px;
    display: inline-block;
    padding-right: 12px;
    padding-top: 8px;
    margin-left: 5px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    }

    How do I call the ava_custom_search?

    Thanks for all your help!
    Guy

    #1405597

    Hi,
    Thanks for the link to your site, the word “Search” is already included, it’s just hidden, please try this css instead of yours:

    #top #menu-item-search .avia_hidden_link_text {
    	display: inline-block;
    }

    After applying the css, please clear your browser cache and check.

    Best regards,
    Mike

    #1405600

    Thanks Mike! That worked perfectly, too.
    Here is my last question about menus. I’ve searched the Web and found a lot of solutions that don’t work for me. Is there an easy way to do a conditional menu-item in the secondary menu? I have one menu item for the learndash user profile. I need it to only show to users who are logged in. The menu-item id is 4002.
    The code I’ve found on Stack Overflow is not working.
    Thanks again,
    Guy

    #1405607

    Hi,
    Try this css

     #top:not(.logged-in) #menu-item-4002 {
     	display: none;
     }

    After applying the css, please clear your browser cache and check.

    Best regards,
    Mike

    #1405608

    Thanks, that works for me. All the other solutions I found were trying to hide the menu-item when you inspect the element. That doesn’t matter to me because you still have to have an account and be logged in to get to the page.

    Thanks again. You’ve been a big help!
    Best regards,
    Guy

    #1405615

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Need to position two menu items to the right and have the rest float right’ is closed to new replies.