WordPress.org

Ready to get started?Download WordPress

Forums

WPtouch Mobile Plugin
[Plugin: WPtouch iPhone Theme] WPTouch doesn't recognize shortcodes created in functions.php (5 posts)

  1. Stephanie Leary
    Member
    Posted 4 years ago #

    I had a weird situation where I needed to insert some menus in our mobile home page's content area. I whipped up a new shortcode that would let me call menus by name ([menu name="students"]), and I stuck this in functions.php:

    function print_menu_shortcode($atts, $content = null) {
         return wp_nav_menu( array( 'menu' => $atts['name'], 'echo' => false ) );
    }
    add_shortcode('menu', 'print_menu_shortcode');

    ... but the shortcodes aren't processed when viewing the mobile version of the page. If I switch to the full view, the menus are shown correctly. As an experiment, I moved this code chunk to a plugin file instead of functions.php, and that also displays correctly.

    http://wordpress.org/extend/plugins/wptouch/

  2. dalemugford
    Member
    Plugin Contributor

    Posted 4 years ago #

    Yes, the desktop theme's functions.php file isn't included in WPtouch. That feature is supported in WPtouch Pro, however.

  3. gillespieza
    Member
    Posted 3 years ago #

    Where does it specify that custom shortcodes are supported in the Pro version? I can't find it in the Features list and I don't want to buy if I can't be sure it supports shortcodes...

  4. marr
    Member
    Posted 3 years ago #

    I had a similar situation trying to get a shortcode to parse in the mobile version. WPTouch has it's own theme files that can be edited. Add your shortcode to the core-functions.php file located at ../wp-content/plugins/wptouch/themes/core/core-functions.php.

  5. Middle8Media
    Member
    Posted 3 years ago #

    hey marr,

    Where exactly do you add the shortcode?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic