Title: Shortcode not working
Last modified: August 22, 2016

---

# Shortcode not working

 *  [mstudioIL](https://wordpress.org/support/users/mstudioil/)
 * (@mstudioil)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/)
 * I using rttheme18 (rttheme18.demo-rt.com) and the shortcode of the columns not
   working I seeing [columns] when I checking on the mobile.
    Other problem is that
   the theme work with Template Builder that I can build templates on the theme 
   management and use it as template option so I do not need to write anything on
   the main editing window, if I work only with the Template Builder I do not see
   anything on the page and if I write something on the main editing windows I can
   see the content but the shortcode do not work
 * [https://wordpress.org/plugins/wptouch/](https://wordpress.org/plugins/wptouch/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Viktor Nagornyy](https://wordpress.org/support/users/viktorix/)
 * (@viktorix)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432034)
 * I can confirm this issue with shortcodes, our custom shortcodes are not being
   rendered by WPTouch template for some reason. Would be nice if WPTouch team fixed
   this bug. We’re using basic functions to create a shortcode:
 *     ```
       function Lead( $atts, $content = null ) {
           return '<div class="lead">'.$content.'</div>';
       }
       add_shortcode("lead", "Lead");
       ```
   
 * Unfortunately, WPTouch does not recognize these shortcodes.
 *  Thread Starter [mstudioIL](https://wordpress.org/support/users/mstudioil/)
 * (@mstudioil)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432035)
 * Thanks, Viktor
    Any idea what I can do?
 *  [Martin Kuplens-Ewart](https://wordpress.org/support/users/mkuplens/)
 * (@mkuplens)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432043)
 * One of the drawbacks of how WordPress handles shortcode (and post type/field)
   registration is that it happens anew every time a page on your site is loaded.
 * When WPtouch handles a mobile request it uses its own mobile themes to handle
   the display of your content, so when a visitor to your site access it with their
   smartphone, your desktop theme is not loaded.
 * If the code for your shortcodes, etc. is inside your desktop theme, whether directly
   or through a framework inside it, they don’t get registered when WPtouch’s theme
   is loaded. And, of course, because WordPress then has no idea they exist, WPtouch
   can’t display their output.
 * We’ve been able to work around this for custom post type support – short of trying
   to load your desktop theme’s functions.php (and subsequent included files), though,
   there is little WPtouch can do to load shortcodes registered by your desktop 
   theme.
 * For these features to reliably work for your mobile site, theme developers will
   need to either move things like this out of their theme files and into a plugin
   or, in the alternative, ship a basic plugin that just loads the necessary theme
   files and calls the limited code required to activate those features for mobile
   requests.
 * We have example code for such a helper plugin available for review – I would 
   welcome theme/framework developers to collaborate with us to ensure that the 
   features their customers rely on work seamlessly across both desktop and mobile
   themes.
 *  [Viktor Nagornyy](https://wordpress.org/support/users/viktorix/)
 * (@viktorix)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432044)
 * Martin, thanks for an explanation. That was my assumption. There’s an easier 
   solution, somewhat similar to how other plugins work to integrate with themes(
   like woocommerce). What about simply having an option where theme developers 
   can create “wptouch.php” file where they simply register all custom features (
   shortcodes, post types, etc.). WPTouch simply checks for that file. Woocommerce
   does a similar check with woocommerce.php file.
 * Where can we find the helper plugin to review and test?
 * In many instances, shortcodes are used in content for styling, layouts, etc. 
   One thing that could provide somewhat of a compatability, is an option for people
   to register their shortcodes inside WPTouch, and WPTouch would simply hide those
   shortcodes from the_content(). That’s the only issue we have with shortcodes,
   they show up in the content since they were used to layout content in a grid.
   Hiding them, would be great.
 *  Thread Starter [mstudioIL](https://wordpress.org/support/users/mstudioil/)
 * (@mstudioil)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432049)
 * Thanks for the explanation.
 *  [Martin Kuplens-Ewart](https://wordpress.org/support/users/mkuplens/)
 * (@mkuplens)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432060)
 * Viktor,
 * WooCommerce’s approach works because the desktop theme remains active when it
   is being called; WPtouch, on the other hand, replaces your regular theme for 
   mobile page loads, so it is just another deactivated theme as far as WordPress
   is concerned (for that request only).
 * Properly separating enhancements into plugins (as some major theme developers
   have once again started doing) is the best approach.
 * The plugin we drafted isn’t a plug-and-play object – rather a proof of concept
   that works for a particular theme framework. Since each framework uses a different
   file structure, each will require a different implementation to correct the problem.
 *  [Viktor Nagornyy](https://wordpress.org/support/users/viktorix/)
 * (@viktorix)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432061)
 * Thanks Martin for explanation. Is it possible to get copy of that plugin? I have
   a client where I would like to try it with and would love to review how you did
   it… it’s better than starting from scratch 🙂
 *  [michael1171](https://wordpress.org/support/users/michael1171/)
 * (@michael1171)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432072)
 * I am not sure whether that helps as I am not a coder. I couldn’t write any PHP
   code from scratch but usually can manage to edit some stuff to make it work the
   way I want.
 * I just started testing WPtouch today. However, some time ago I already added 
   a rather simple custom shortcode to my desktop theme. It’s an automatic counter
   that creates consecutive numbers within a page or post.
 * I don’t know much about the structure of other themes but my desktop theme has‘
   functions.php’ in the theme root which includes ‘lib/shortcodes.php’ for the 
   theme specific shortcodes.
    To add my custom shortcode I created a ‘my-shortcodes.
   php’ file and added a line to ‘functions.php’ to include my custom shortcode 
   file as well.
 * Of course today WPtouch first simply rendered [shortcodename].
    What I then did
   was to copy my custom shortcode file to the WPtouch theme folder (copy, just 
   in case I want to modify it for the mobile version) and then included it in the
   WPtouch theme’s ‘function.php’. (Also added the according CSS code to WPtouch).
   Works!
 * I guess in case you also want to add the theme specific shortcodes to the WPtouch
   theme you could just include them the same way. Or if you just want to get rid
   of those shortcodes create a ‘custom-shortcodes.php’ file with a function for
   each shortcode like
 *     ```
       function xy_shortcode() {return '';}
       add_shortcode('xy_shortcode', 'xy_shortcode');
       ```
   
 * I guess that should work. I am no coder and I doubt that my approach is very 
   elegant and I have no clue yet what happens in case of a plugin update?
 *  [michael1171](https://wordpress.org/support/users/michael1171/)
 * (@michael1171)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432073)
 * Oh, I just found that there is a way to get rid of shortcodes under ‘WPtouch 
   Core Settings / Compatibility’. Stupid me, haha.
 * Anyway, in my case that way I would lose my automaticly created image numbers.
   
   Example here: [http://studioa.eu/portfolio/building-facades/](http://studioa.eu/portfolio/building-facades/)(
   Currently only desktop version online)

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Shortcode not working’ is closed to new replies.

 * ![](https://ps.w.org/wptouch/assets/icon-256x256.png?rev=1313960)
 * [WPtouch - Make your WordPress Website Mobile-Friendly](https://wordpress.org/plugins/wptouch/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wptouch/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wptouch/)
 * [Active Topics](https://wordpress.org/support/plugin/wptouch/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wptouch/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wptouch/reviews/)

 * 9 replies
 * 4 participants
 * Last reply from: [michael1171](https://wordpress.org/support/users/michael1171/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/shortcode-not-working-84/#post-5432073)
 * Status: not resolved