• Resolved KS

    (@karl19)


    Hello, I am trying to show two different mobile menus based on a conditional. For the desktop menu I have defined two menu theme locations and doing this:

    if ( is_page(123) ) {
      if( 'primary' == $args['theme_location'] ) {
        $args['theme_location'] = 'menu-alt';
      }
    }

    This works fine. For the mobile setup, I was hoping to do the same thing, but I can’t figure out the theme_location of the plugin – it seemed to be ‘mobile’, but that doesn’t work.

    Then I tried to use the plugin shortcode, as described here https://responsive.menu/knowledgebase/using-the-shortcode/. But it doesn’t seem to use any variables, if I use:

    <?php echo do_shortcode('[responsive_menu menu_title="Alternative Title"]'); ?>

    it doesn’t change the title. Same thing with menu_to_use or theme_location_menu, they don’t seem to change the output, it’s always showing the menu set under general menu settings in admin.

    I can’t find any more info about this, any pointers would be appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi KS,

    I request you to update RM to its latest version (v4.1.9) and check. Hope your issue will get resolved.
    Do let me know if you still face the issue.

    Regards,
    sumit

    Thread Starter KS

    (@karl19)

    Hi Sumit, many thanks for the reply. I finally had a chance to look at this issue again, as we delayed the functionality.

    I have updated to v. 4.1.11, unfortunately it doesn’t seem to solve the issue. Although it looks like in the code, that the theme location for the plugin should be “mobile”, if I use:

    if( 'mobile' == $args['theme_location'] ) {
        $args['theme_location'] = 'menu-alt';
    }

    it doesn’t seem to override the selected menu. Is it possible to query the theme_location for the responsive menu like that in functions.php?

    As for the second issue about shortcode, I don’t see the menu setting listed here https://responsive.menu/knowledgebase/using-the-shortcode/ any longer? Unser Settings > Advanced Settings > Technical I only see PRO options (I use the free version) and there is nothing about enabling a shortcode for the menu. On the menu overview page, it says “Shortcode deactivated”.

    Any help would be appreciated!

    Hi KS,

    That option is not available in the free version you need to use the pro version of the plugin and then check. Let me know if you need more help.

    Regards,
    sumit

    Thread Starter KS

    (@karl19)

    Hi Sumit, many thanks for your reply!

    I finally figured out where to activate shortcodes for individual menus under Menu > Settings > General Settings > Display condition > Use as shortcode.

    Then instead of using theme locations, I created two identical mobile menus, linking them to two different WordPress menus. After that I could query the two different shortcodes with a conditional:

    if ( is_page(123) ) {
      echo do_shortcode('[rmp_menu id="xxx"]');
    } else {
      echo do_shortcode('[rmp_menu id="yyy"]');
    }

    It’s a bit more redundant since I need to set up multiple mobile menus, but it solves my problem.

    Thanks for providing this plugin!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode variables’ is closed to new replies.