<div dir="ltr">Thanks for passing that along, Daniel.<div><br></div><div>And this list is certainly intended to discuss such things. Especially as it directly relates to Guidelines/review philosophy, I wouldn't consider it "junk".</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 13, 2013 at 8:42 PM, Daniel <span dir="ltr"><<a href="mailto:danielx386@gmail.com" target="_blank">danielx386@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi guys,<br><br>I know that you don't like people passing on junk but I just got this in my inbox and I feel that it hit the nail on the head about including shortcodes in themes.<br>
<br>Enjoy :)<br><br><div class="gmail_quote">

---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Theme Lab</b> <span dir="ltr"><<a href="mailto:leland@themelab.com" target="_blank">leland@themelab.com</a>></span><br>Date: Sun, Jul 14, 2013 at 10:18 AM<br>


Subject: Theme Lab<br>To: <br><br><br><u></u>





<div>

<div style="line-height:140%;font-size:13px;font-family:Georgia,Helvetica,Arial,Sans-Serif;margin:0 2em">
<table style="border:0;padding:0;margin:0;width:100%">
<tbody><tr>
<td style="vertical-align:top" width="99%">
<h1 style="margin:0;padding-bottom:6px">
<a style="color:#888;font-size:22px;font-family:Arial,Helvetica,sans-serif;font-weight:normal;text-decoration:none" href="http://www.themelab.com" title="(http://www.themelab.com)" target="_blank">Theme Lab</a>
</h1>
</td>
<td width="1%">
<a href="http://www.themelab.com" target="_blank">
<img alt="Link to Theme Lab" style="padding:0 0 10px 3px;border:0">
</a>
</td>
</tr>
</tbody></table>
<hr style="border:1px solid #ccc;padding:0;margin:0">
<table>
<tbody><tr>
<td style="margin-bottom:0;line-height:1.4em">
<p style="margin:1em 0 3px 0">
<a name="13fdaa15eff5a0dc_13fda8ae8947dbb9_1" style="font-family:Arial,Helvetica,sans-serif;font-size:18px" href="http://www.themelab.com/2013/07/13/put-shortcodes-in-a-plugin/" target="_blank">Shortcodes Should Never Be Included With Themes. Period.</a>
</p>
<p style="font-size:13px;color:#555;margin:9px 0 3px 0;font-family:Georgia,Helvetica,Arial,Sans-Serif;line-height:140%;font-size:13px">
<span>Posted:</span> 13 Jul 2013 12:28 PM PDT</p>
<div style="line-height:140%;font-size:13px;font-family:Georgia,Helvetica,Arial,Sans-Serif;margin:0"><p>ThemeForest <a href="http://notes.envato.com/news/announcement-wordpress-theme-submission-requirements/" target="_blank">recently</a> updated their <a href="http://support.envato.com/index.php?/Knowledgebase/Article/View/472/85/wordpress-theme-submission-requirements" target="_blank">WordPress theme submission requirements</a> to be more stringent and more inline with WordPress theme development best practices.</p>



<p>The guidelines require the use several of WordPress’ core features, standard theme hooks, and disallow PHP functions (like base64 and fopen) that really <b>shouldn’t have ever had any place in a WordPress theme</b> to begin with.</p>



<p>Basically, pretty much WordPress.org’s <a href="http://codex.wordpress.org/Theme_Review" target="_blank">Theme Review policy</a>, give or take a few things.</p>
<p>Overall, it’s a step in the right direction and moves to <b>promote best practices on one of the most popular WordPress theme marketplaces</b> on the net. There’s just one problem…</p>
<h3>Admissible Shortcodes</h3>
<p>One thing that particularly caught my eye, however, was how <b>certain “admissible” shortcode functionality was allowed</b> (i.e. by directly including them through the theme’s <code>functions.php</code> file). The ones listed as “admissible” included the following:</p>



<ul>
<li>buttons</li>
<li>pricing tables</li>
<li>image containers</li>
<li>dropcaps</li>
<li>lists</li>
</ul>
<p>Inadmissible shortcodes include: maps, accordions and toggles, boxed contents, column, contact forms, charts.</p>
<h3>The Problem with Shortcodes in Themes</h3>
<p>I can’t really put it better than <a href="http://justintadlock.com/archives/2011/05/02/dealing-with-shortcode-madness" title="Dealing with shortcode madness" target="_blank">Justin Tadlock already has</a>. One of the most noticeable issues, is that when a user changes themes, the <b>shortcodes will no longer be parsed</b>.</p>



<p>Let’s say “Super Awesome” theme had a shortcode feature that would output a big green button with a link when you typed out something like <code>[button url="<a href="http://example.com" target="_blank">http://example.com</a>"]Big Green Button[/button]</code>.</p>



<p><a style="background:green;color:white;display:inline-block;text-align:center;font-size:50px;padding:20px;line-height:50px" href="#13fdaa15eff5a0dc_13fda8ae8947dbb9_" title="This link goes nowhere">Big Green  Button</a></p>

<p>When you switch to another theme (let’s face it, people get bored of themes easily), there’s no more big green button. Instead, <b>you see the unparsed shortcode in the post</b> as if it were any other piece of content, like this:</p>



<p>[button url="<a href="http://example.com" target="_blank">http://example.com</a>"]Big Green Button[/button]</p>
<p>It looks ugly, confusing, and out-of-place, and it’s a <b>pain for the user to go back and remove/replace</b> all of them.</p>
<h3>The Other Problem with Shortcodes in Themes</h3>
<p>Something that Tadlock went over in his “Dealing with shortcode madness” article is, a lot of shortcodes are so simple and HTML-like, it might even be best to instruct users to write out a little (*gasp*) <b>real HTML code</b>.</p>



<p>The same <code>[button url="<a href="http://example.com" target="_blank">http://example.com</a>"]Button Text[/button]</code> shortcode in my example above could be <b>easily rewritten</b> as something like:</p>



<p><code><a href="<a href="http://example.com" target="_blank">http://example.com</a>" class="button">Button text here</a></code></p>
<p>While there may not be CSS code styling the <code>.button</code> selector in a new theme, at least a normal link will show up. <b>Which is a big improvement</b> over an unparsed <code>[button]</code> shortcode showing up in a post’s content.</p>



<p>Plus, I believe every WordPress user <b>should have at least some basic understanding of HTML code</b>. By teaching them, even in little bits (like how to construct a link), will help. If they can understand a shortcode, it won’t take much more to get them to understand basic HTML.</p>



<h3>But The Users Don’t Care!</h3>
<p>A common argument I see defending all sorts of bad practices when it comes to theme development is that the users simply <i>don’t care</i>. I mean, maybe they never want to update their theme, in which case, this <b>shortcode issue would be a moot point</b>.</p>



<p>The problem is, some users <b>inevitably will want to switch themes</b> some day. Some users will want to install a plugin that might conflict with some other poorly-thought-out code in a theme.</p>
<p>Then, they probably will care, and probably will wonder if the theme they bought with 100s of built-in shortcodes and other <b>superfluous features was really worth it</b>.</p>
<h3>The Right Way to Include Shortcodes</h3>
<p>Put it in a plugin. A really simple plugin. It doesn’t need a separate options panel. <b>Just literally copy and paste</b> whatever you were going to include via your theme’s functions.php file, and <a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">put it in a plugin</a> instead.</p>



<p>It could even be bundled with something like <a href="http://tgmpluginactivation.com/" target="_blank">TGM Plugin Activation</a> to make it required on theme activation. Or not. A <b>theme is still a theme without shortcodes</b>.</p>



<p>This way, if the user changes themes, the <b>shortcodes will still work</b>, because that functionality is handled by the plugin that is still active.</p>
<p>Maybe the plugin could also <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style" target="_blank">enqueue styles</a> for the shortcodes as well. This way, the big green buttons you included with the [button] shortcode will still be big green buttons, regardless of the theme used.</p>



<h3>Why Did ThemeForest Allow “Admissible” Shortcodes?</h3>
<p>It’s hard to say what exactly the reasoning behind this decision was. Japh Thomson, a WordPress evangelist at Envato (ThemeForest’s parent company) had this to say about it <a href="http://wpmu.org/themeforest-developer-guidelines/#comment-143884" target="_blank">in a comment on WPMU.org</a>:</p>



<blockquote><p>Complex shortcode functionality really should reside in a plugin, not a theme. It also just makes sense when you consider most of our authors have multiple themes.</p></blockquote>
<p>Obviously, he gets it. So it’s a <b>mystery to me why there would be any “admissible” shortcodes</b> at all. And yes, I realize he used the word “complex” in the quote above, and the admissible shortcodes do tend to be pretty simple ones (dropcaps, lists, etc.).</p>



<p>Simple as a shortcode may be, the <b>problems I outlined above will still exist</b>. ThemeForest has shown to be responsive to community feedback, so it’s possible this rule is amended in the future.</p>
<h3>Conclusion</h3>
<p>I realize this post <b>seems a bit nit-picky</b>, and these new guidelines are definitely a huge step in the right direction. But there’s really no reason any shortcode should be allowed in a theme, simple or not.</p>



<p style="text-align:center">
</p><blockquote>
<p>Can you think of a situation when a publicly released theme absolutely needs to include shortcode functionality via its own functions.php?</p>
<p>— Theme Lab (@themelab) <a href="https://twitter.com/themelab/statuses/354662109273001984" target="_blank">July 9, 2013</a></p></blockquote>
<p></p>
<p><b>Spoiler alert:</b> Didn’t get any responses to that tweet with a real example of a shortcode absolutely needing to be included in a publicly-released theme.</p>
<p>That’s because it’s <b>just not user-friendly</b> for a user to go back and replace hundreds of button shortcodes after they switched to a theme that doesn’t have the exact same shortcode support.</p>


<p>Related posts:</p><ol><li><a href="http://www.themelab.com/2013/07/06/why-wordpress-widgets-disappear/" rel="bookmark" title="Permanent Link: Why WordPress Widgets Vanish When Migrating to New URL" target="_blank">Why WordPress Widgets Vanish When Migrating to New URL</a></li>



<li><a href="http://www.themelab.com/2010/08/16/use-the-official-tweet-button/" rel="bookmark" title="Permanent Link: Want More Retweets? Use the Official Tweet Button" target="_blank">Want More Retweets? Use the Official Tweet Button</a></li>



<li><a href="http://www.themelab.com/2011/01/21/theme-devs-random-snippets/" rel="bookmark" title="Permanent Link: Dear Theme Devs, Stop Pasting Random Snippets of Code in functions.php" target="_blank">Dear Theme Devs, Stop Pasting Random Snippets of Code in functions.php</a></li>



</ol><p></p><div>
<a href="http://feeds.feedburner.com/%7Eff/ThemeLab?a=p1T3HwxtCQk:9_BjVYpP3LU:hJo_UCMZ9e0" target="_blank"><img border="0"></a> <a href="http://feeds.feedburner.com/%7Eff/ThemeLab?a=p1T3HwxtCQk:9_BjVYpP3LU:D7DqB2pKExk" target="_blank"><img border="0"></a> <a href="http://feeds.feedburner.com/%7Eff/ThemeLab?a=p1T3HwxtCQk:9_BjVYpP3LU:F7zBnMyn0Lo" target="_blank"><img border="0"></a> <a href="http://feeds.feedburner.com/%7Eff/ThemeLab?a=p1T3HwxtCQk:9_BjVYpP3LU:yIl2AUoC8zA" target="_blank"><img border="0"></a> <a href="http://feeds.feedburner.com/%7Eff/ThemeLab?a=p1T3HwxtCQk:9_BjVYpP3LU:3Nb2VdUv6vk" target="_blank"><img border="0"></a>
</div><p></p></div>
</td>
</tr>
</tbody></table>
<table style="border-top:1px solid #999;padding-top:4px;margin-top:1.5em;width:100%">
<tbody><tr>
<td style="text-align:left;font-family:Helvetica,Arial,Sans-Serif;font-size:11px;margin:0 6px 1.2em 0;color:#333">You are subscribed to email updates from <a href="http://www.themelab.com" target="_blank">Theme Lab</a>
<br>To stop receiving these emails, you may</td>
<td style="font-family:Helvetica,Arial,Sans-Serif;font-size:11px;margin:0 6px 1.2em 0;color:#333;text-align:right;vertical-align:top">Email delivery powered by Google</td>
</tr>
<tr>
<td colspan="2" style="text-align:left;font-family:Helvetica,Arial,Sans-Serif;font-size:11px;margin:0 6px 1.2em 0;color:#333">Google Inc., 20 West Kinzie, Chicago IL USA 60610</td>
</tr>
</tbody></table>
</div>
</div>

</div><br>
<br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>