Title: Shortcode variables
Last modified: February 2, 2022

---

# Shortcode variables

 *  Resolved [KS](https://wordpress.org/support/users/karl19/)
 * (@karl19)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-variables-2/)
 * 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/](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)

 *  [sumitsanadhya](https://wordpress.org/support/users/sumitsanadhya/)
 * (@sumitsanadhya)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/shortcode-variables-2/#post-15479512)
 * 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](https://wordpress.org/support/users/karl19/)
 * (@karl19)
 * [4 years ago](https://wordpress.org/support/topic/shortcode-variables-2/#post-15695198)
 * 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/](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!
 *  [sumitsanadhya](https://wordpress.org/support/users/sumitsanadhya/)
 * (@sumitsanadhya)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/shortcode-variables-2/#post-15730199)
 * 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](https://wordpress.org/support/users/karl19/)
 * (@karl19)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/shortcode-variables-2/#post-15890994)
 * 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.

 * ![](https://ps.w.org/responsive-menu/assets/icon-256x256.png?rev=1782326)
 * [Responsive Menu - Create Mobile-Friendly Menu](https://wordpress.org/plugins/responsive-menu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/responsive-menu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/responsive-menu/)
 * [Active Topics](https://wordpress.org/support/plugin/responsive-menu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/responsive-menu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/responsive-menu/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [KS](https://wordpress.org/support/users/karl19/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/shortcode-variables-2/#post-15890994)
 * Status: resolved