Menu above built with this plugin including Mega Menu.

Shortcode Option not working

This topic contains 11 replies, has 2 voices, and was last updated by  Peter Featherstone 2 weeks, 2 days ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #57019 Reply

    Steffen
    Participant

    Hello,

    i’m using the responsive menu pro plugin with the avada theme. i want to use the shortcode option because i have two different menus (one onepage menu for the start page and one “normal” menu for all sub pages.

    mainmenu-onepage -> this menu is for the onpage page
    mainmenu-multipage -> this menu is for all other pages

    i have enabled the shortcut option and after that no menu was displayed.
    After that i copied <?php echo do_shortcode(‘[responsive_menu_pro]’); ?> to my header.php and the responsive menu was shown.

    But on all pages the menu is displayed, that i have select in the “Menu to Use ” in the responsive menu settings.
    Then i put the shortcode [responsive_menu_pro menu_to_use=”mainmenu-onepage”] on the page (in wordpress, not in a php file sor something like that), where i want to have a different menu .

    But on this page is still the mainmenu-multipage menu shown. What did i wrong?
    Thanks and best regards,
    Steffen

    #57020 Reply

    Hey Steffen,

    It looks fine to me, did you check caches or confirm the slug is correct. Also check you have nothing in the Theme Location option.

    Please let me know

    Peter

    #57111 Reply

    Steffen
    Participant

    Hi Peter,

    now the hamburger menu is shown twice on the page where i have placed the shortcode but its not working.
    Maybe you can have a look at the site: https://bilderrahmen.holzkirchner.de

    The menu is only displayed on smartphones or if the width is less then 800px

    On the start page the menu mainmenu-onepage should be displayed.
    On all other pages mainmenu-multipage should be displayed.

    At the moment on all pages the mainmenu-multipage is displayed.

    I have the following settings:
    in the template header.php i have insert follwing code: <?php echo do_shortcode(‘[responsive_menu_pro]’); ?>;
    On the start page i have insert this code into the page: [responsive_menu_pro menu_to_use=”mainmenu-onepage”]
    In the Responsive Menu Pro Settings i have set the “mainmenu-multipage” in the option “menu to use” and have enabled the shortcode option.

    It would be great if you can help me.
    Best regards,
    Steffen

    #57112 Reply

    Hey Steffen,

    If it’s shown twice and you have the shortcode option on then it sounds like you are loading the shortode twice.

    It sounds like you are loading it on the header on every page and then loading it again on the start page separately.

    You will need to only load the shortcode once.

    All the best

    Peter

    #57113 Reply

    Steffen
    Participant

    Thanks Peter for this fast answer.

    Ok, i removed the shortcode from the header and now its only shown on the start page (where i insert the shortcode).
    Maybe i’m a little bit stupid but now i have the problem, that the hamburger menu is not shown on the header position – its shown on the position on the start page where i insert it.

    I want that the hamburger menu is shown in the header (on the position where the original menu of avada is displayed).
    If i put the shortcode in the header.php, the menu is displayed on the correct position but i can use on all pages only the same menu…
    If i put the shortcode on the wordpress page, the menu i displayed on the wrong position but i can use different menus on different pages.

    How can i achieve my goal to get one menu for the start page and one menu for all other pages?

    #57114 Reply

    Hey Steffen,

    Yes the shortcode will be displayed wherever you insert the code.

    Aren’t there any defining factors for that page that you can use to define which menu to use and then just wrap them in an if statement?

    There are examples of such things on the shortcode page below:

    https://responsive.menu/knowledgebase/using-the-shortcode/

    Please advise

    Peter

    #57116 Reply

    Steffen
    Participant

    Hi Peter,

    thanks – i’m not a php guru.
    I could check for -> <link rel=”canonical” href=”https://bilderrahmen.holzkirchner.de/bilderrahmen/” />

    Is this the correct if statement?

    
    <?php
     
    if(<link rel="canonical" href="https://bilderrahmen.holzkirchner.de/" />)
         echo do_shortcode('responsive_menu_pro menu_to_use="mainmenu-onepage"]');
    else
         echo do_shortcode('[responsive_menu_pro"]');
    ?>
    

    Thank you very much!

    Best regards,
    Steffen

    #57117 Reply

    Hey Steffen,

    That if statement isn’t valid PHP, I’m surprised if that worked for you.

    You could use the page ID and check on that if you know the ID of that paricular page.

    You could also check the current url of the page you are on inside the if statement or use the various wordpress functions for determining if you are on the home page or not.

    Please let me know how you get on with those.

    Peter

    #57118 Reply

    Steffen
    Participant

    Thanks Peter for pointing me in the right direction.
    This code is working

    
    <?php
     if($page = '104')
         echo do_shortcode('[responsive_menu_pro menu_to_use="mainmenu-onepage"]');
    else
         echo do_shortcode('[responsive_menu_pro"]');
    ?>
    

    Best regards,
    Steffen

    #57119 Reply

    Hey Steffen,

    That looks much better :-)

    I’m glad you got it working now and I hope you enjoy the plugin!

    Peter

    #57120 Reply

    Steffen
    Participant

    Thanks for your great and fast support. i’m very impressed :)

    #57121 Reply

    You’re more than welcome :-)

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: Shortcode Option not working
Your information:





<a href="" title="" rel="" target=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width="">

Responsive Menu Title Image
Responsive Menu
No coding knowledge needed