<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>WordPress Plugin &#8211; YouTube for XHTML and Mobile &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/2009/07/wordpress-plugin-youtube-xhtml-mobile/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Wed, 04 Oct 2023 18:56:10 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>WordPress Plugin &#8211; YouTube for XHTML and Mobile &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[WordPress Plugin - YouTube for XHTML and Mobile]]></title>
		<link>https://shkspr.mobi/blog/2009/07/wordpress-plugin-youtube-xhtml-mobile/</link>
					<comments>https://shkspr.mobi/blog/2009/07/wordpress-plugin-youtube-xhtml-mobile/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 12 Jul 2009 16:41:20 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[YouTube]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=252</guid>

					<description><![CDATA[This blog is XHTML 1.0 Strict.  Unfortunately, the code produced by YouTube for embeding their videos isn&#039;t.  Nor is it compatible with the dotMobi WordPress Mobile Pack.  This scrap of code is a WordPress Plugin.  it allows me to write something like [youtube id=&#34;p5ACl4iBGd0&#34;]  The code then outputs either the XHTML 1.0 embeding code or the XHML-MP code which links to the mobile version of the…]]></description>
										<content:encoded><![CDATA[<p>This blog is XHTML 1.0 Strict.  Unfortunately, the code produced by YouTube for embeding their videos isn't.  Nor is it compatible with the <a href="http://mobiforge.com/running/story/the-dotmobi-wordpress-mobile-pack">dotMobi WordPress Mobile Pack</a>.</p>

<p>This scrap of code is a WordPress Plugin.  it allows me to write something like
<code>[youtube id="p5ACl4iBGd0"]</code></p>

<p>The code then outputs either the XHTML 1.0 embeding code or the XHML-MP code which links to the mobile version of the site</p>

<pre>function youtube_func($attr)
 {
 //Get the name of the Wordpress Template being used
 $name = get_template();

 //If this *isn't* a mobile theme
 if(stristr($name, 'mobile') === FALSE)
 {
 //Link to embeded YouTube video source
 $ytURL = "http://www.youtube.com/v/" . $attr['id'];

 //XHTML 1.0 Strict way of embeding movies
 $s = "&lt;object type="application/x-shockwave-flash" style="width:450px; height:366px;" data="" . $ytURL . ""&gt;"
 . "&lt;param name="movie" value="". $ytURL . "" /&gt;"
 . "&lt;/object&gt;";

 return $s;

 }
 else //This is a mobile theme
 {
 //Link to mobile YouTube
 $mYtURL = "http://m.youtube.com/watch?v=" . $attr['id'];
 //Image of the video
 $mYtIMG = "http://i.ytimg.com/vi/" . $attr['id'] . "/default.jpg?w=128&amp;amp;h=96";

 $s = "&lt;a href="" . $mYtURL . ""&gt;"
 . "&lt;img src="" . $mYtIMG . "" /&gt;"
 . "&lt;/a&gt;";

 return $s;
 }
 }
 add_shortcode('youtube', 'youtube_func');</pre>

<p>Many thanks to the <a href="http://codex.wordpress.org/Shortcode_API">Wordpress API</a>, this excellent <a href="http://planetozh.com/blog/2008/03/wordpress-25-shortcodes-api-overview/">Wordpress Plugin Tutorial</a>, and this <a href="http://www.tools4noobs.com/online_tools/youtube_xhtml/">Valid XHTML YouTube embed code generator</a>.</p>

<p>You can <a href="http://wordpress.org/extend/plugins/youtube-xhtml-and-mobile/">download the plugin from WordPress</a>.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=252&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2009/07/wordpress-plugin-youtube-xhtml-mobile/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
	</channel>
</rss>
