While we&#39;re on the Shortcodes and Git subjects, I did some testing on a few themes I have that use shortcodes mostly for static styling, i.e. pricing boxes, author fields, column shortcodes etc that provide some markup layout that wraps some details and forms page output based on this data. <div>

<br>So I wrote a small snippet that does this conversion - <a href="https://github.com/mpeshev/DX-Shortcode-Freezer">https://github.com/mpeshev/DX-Shortcode-Freezer</a></div><div><br>It&#39;s probably not optimized or secure enough, but it can actually help when switching themes and prevent the &#39;hundreds of pages with square bracket snippets&#39; hell. This one evaluates the shortcodes and replaces the DB content with the actual HTML markup at the moment of generation. Then switching between themes is a little less painful.   <br clear="all">

<br>Mario Peshev<br>Training and Consulting Services @ DevriX<br><a href="http://www.linkedin.com/in/mpeshev" target="_blank">http://www.linkedin.com/in/mpeshev</a><br><a href="http://devrix.com" target="_blank">http://devrix.com</a><br>

<a href="http://peshev.net/blog" target="_blank">http://peshev.net/blog</a><br><br>
<br><br><div class="gmail_quote">On Fri, Feb 17, 2012 at 10:04 PM, Otto <span dir="ltr">&lt;<a href="mailto:otto@ottodestruct.com">otto@ottodestruct.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On Fri, Feb 17, 2012 at 1:26 PM, Bruce Wampler &lt;<a href="mailto:weavertheme@gmail.com">weavertheme@gmail.com</a>&gt; wrote:<br>
&gt; And as for YouTube, my theme is completely responsive, as well as including<br>
&gt; extensive mobile device specific support (things beyond being responsive,<br>
&gt; such as selective excerpt/full display of posts, or using different menus<br>
&gt; depending on the device). There simply are no existing ways to properly<br>
&gt; display YouTube videos without the intimate knowledge my theme has about the<br>
&gt; device it is being displayed on. And it is really critical that the videos<br>
&gt; be displayed properly on a specific device. Not allowing a theme integrated<br>
&gt; shortcode for that would completely break proper display of those videos.<br>
<br>
</div>I was curious about this, so I decided to test a theory.<br>
<br>
If you adjust the $content_width global dynamically based on the<br>
device width detection method you&#39;re using (say you detect an iPhone<br>
and so set it to something less than 480),then the built in oEmbed<br>
technique will change to adapt to it.<br>
<br>
For example: make a test site using twentyeleven. Embed a youtube vid<br>
on there using the [embed] code or using the URL-on-its-own-line<br>
method. Load the site and you&#39;ll see the youtube video at 584 pixels<br>
wide.<br>
<br>
Now, edit the twentyeleven functions.php file and change the<br>
$content_width to, say 300. Load the site again. Note that you haven&#39;t<br>
edited the post or changed the site in any other way. You&#39;ll find the<br>
video is now smaller.<br>
<br>
Note that it will take a second longer to display the page the first<br>
time with the new width, because oembed has to get triggered into<br>
making a new call to the Youtube oembed endpoint, but the result of<br>
this will be cached in the post_meta, so it only makes that one hit to<br>
get the new iframe code from Youtube.<br>
<br>
The reason this works has to do with the caching mechanism of oembed.<br>
In processing the normal [embed] shortcode, the handler checks<br>
post_meta for the cached response from the oembed http request.<br>
However, the cache key is an MD5 of the serialized array of<br>
attributes. Those attributes include the URL being requested, of<br>
course, but also the width it&#39;s asking for. The $content_width is the<br>
default width used, and if the $content_width changes, then the cache<br>
keys won&#39;t match and it&#39;ll make a new request with the new attributes.<br>
<br>
So here, you&#39;re mistaken. You don&#39;t necessarily need to have a special<br>
shortcode for handling youtube videos, or any other videos that are<br>
supported by oEmbed. All you have to do is adjust your $content_width<br>
to one that is appropriate for the device. Then the built in embed<br>
mechanisms will handle it just fine.<br>
<font color="#888888"><br>
-Otto<br>
</font><div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br></div>