ThemeForest has recently updated its WordPress theme submission requirements to be more stringent and more in line with WordPress theme development best practices.
The guidelines require the use of several core WordPress features, standard theme hooks, and disallow PHP functions (such as base64 and fopen) that really should have had no place in a WordPress theme to begin with.
Basically, pretty much the WordPress.org theme review policy , plus or minus a few things.
Overall, it's a step in the right direction and moves to russian virtual mobile number promote best practices in one of the most popular WordPress theme marketplaces on the web. There's just one problem…
Acceptable Shortcodes
One thing that particularly caught my attention, however, was how certain “allowable” shortcode functionality was allowed (i.e. by including them directly through the functions.theme’s php file). Among those that were listed as “allowable” were the following:
buttons
price tables
image containers
drop-down covers
lists
Inadmissible shortcodes include: maps, accordions and toggles, boxed content, columns, contact forms, charts.
The problem with shortcodes in themes
I really can't put it any better than Justin Tadlock already did . One of the most notable issues is that when a user switches themes, shortcodes will no longer be parsed .
Let's say the "Super Awesome" theme has a shortcode that displays a big green button with a link when you type something like [button url="
Big Green Button
When you switch to another theme (let's face it, people get bored of themes easily), there's no longer a big green button. Instead, you'll see the unparsed shortcode in the post like any other piece of content, like this:
[button url=
It looks ugly, confusing and out of place, and it's a pain for the user to go back and delete/replace all of them.
The other problem with shortcodes in themes
Something Tadlock addressed in his article “Dealing with shortcode madness” is that many shortcodes are so simple and HTML-like, that it might be better to instruct users to write a little (*gasp*) actual HTML code .
The same ["]Texto del botón[/button] shortcode in my example above could easily be rewritten as something like:
<a href=">Texto del botón aquí</a>
While there may not be any CSS code to style the .button selector in a new theme, at least a normal link will appear. Which is a big improvement over an [buttonunparsed ] shortcode appearing in a post's content.
Also, I think that all WordPress users should have at least a basic understanding of HTML code . Teaching them even in small parts (like link building) will help them. If they can understand a shortcode, it won't take much more for them to understand basic HTML.
But users don't care!
A common argument I see defending all sorts of bad practices when it comes to theme development is that users just don't care . I mean, maybe they never want to update their theme, in which case, this shortcode issue would be a moot point .
The problem is that some users will inevitably want to change themes someday. Some users will want to install a plugin that might conflict with some other poorly thought-out code in a theme.
So, you will probably worry, and you will probably wonder if the theme you bought with hundreds of built-in shortcodes and other superfluous features was really worth it .
The correct way to include shortcodes
Put it in a plugin. A really simple plugin. It doesn't need a separate options panel. Just literally copy and paste what you were going to include via your theme's functions.php file, and put it in a plugin instead.
It could even be bundled with something like TGM Plugin Activation to make it required on theme activation. Or not. A theme is still a theme without shortcodes .
This way, if the user switches themes, the shortcodes will still work , because that functionality is handled by the plugin that is still active.
Perhaps the plugin could also enqueue styles for the shortcodes. This way, the big green buttons you included with the [button] shortcode will remain big green buttons, regardless of the theme used.