Shortcodes are a truly remarkable feature of WordPress. They make it possible to easily add advanced functionality and features to pages, inject content into posts, and more. In the past, site owners have had to rely on plugins to add shortcode capabilities to their site but recently some developers have started including them in their WordPress themes. It’s an attractive proposition for site owners: buy a theme and instantly get advanced functionality without chasing down a handful of plugins.
Trouble with Shortcodes
But WordPress is forgetful. It only remembers how to handle shortcodes for one page request and must re-learn every shortcode each time a page is loaded. It is this forgetfulness that makes it possible to activate a new theme and instantly have a transformed admin experience! And usually, with plugins registering advanced functionality, it works great. After all, plugins are loaded on every request, regardless of which theme is active.
If you’ve ever swapped out your WordPress theme to one that doesn’t have the same shortcodes, though, you’ll already be familiar with the problem: WordPress suddenly can’t understand the shortcode and leaves it in your pages and posts unprocessed!
WPtouch Pro works the same way: when the plugin steps in to take care of your mobile visitor, it begins by telling WordPress to set aside your desktop theme and use your chosen mobile theme instead. If your content has relied on shortcodes from the desktop theme, you may have seen unprocessed shortcodes appear in your posts and on your pages.
Making Progress
The same problem existed in the past with custom post types. We made big progress with custom post types in 2014 enabling WPtouch Pro to learn about the custom post types used in your site and then re-registering them when your site is accessed. As a result, WordPress always knows they exist, and is able to load your content for mobile visitors.
Although in the past we’ve encouraged site owners to make use of our ability to load your desktop theme’s functions.php files to try to fix this issue, the complexity of modern WordPress themes has made this less useful than it has been in the past. After reaching out to major theme framework developers to try to find a resolution to the shortcode problem, we determined the time had come for a complete re-think of our approach.
A new approach – and a solution
Today shortcode compatibility for mobile visitors is taking a huge leap forward with WPtouch Pro 3.7. With just one click you can enable our all-new shortcode handling, which loads your page and post text as though the desktop theme had been active all along.
Although this new feature will take care of almost all needs, you may need to use WPtouch Pro’s custom code feature to include any styling/scripts relied on for advanced functionality such as content tabbing.
The WPtouch Pro 3.7 update is available now for all customers with an active license, via your WordPress dashboard for licensed sites and the Account page here on wptouch.com.
We’re excited to finally be able to share this development with you and look forward to your feedback and to seeing what you do with WPtouch Pro.