<?xml version="1.0" encoding="UTF-8"?>
<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>Coding</title>
	<atom:link href="http://coding.my-guide.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://coding.my-guide.org</link>
	<description>Hooks&#039;n Hacks</description>
	<lastBuildDate>Sat, 28 Nov 2009 13:29:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to show random posts after current post</title>
		<link>http://coding.my-guide.org/wordpress/how-to-show-random-posts-after-current-post/</link>
		<comments>http://coding.my-guide.org/wordpress/how-to-show-random-posts-after-current-post/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 10:58:34 +0000</pubDate>
		<dc:creator>Bako</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress MU]]></category>
		<category><![CDATA[$wpdb->get_results]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[get_the_title()]]></category>
		<category><![CDATA[Random posts]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=35</guid>
		<description><![CDATA[Difficulty Level: It is very useful to show some random posts after the current reading post. You online need one litle function for that: How this works? Get the current post title with &#8220;$current_post = get_the_title();&#8221; because, we won&#8217;t show this title again Get x random posts &#8220;&#8230;$random_posts = $wpdb-&#62;get_results&#8230;&#8221; Go trought each post, get [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Difficulty Level:</p>
<p style="text-align: left"><img class="alignnone size-full wp-image-27" src="http://coding.my-guide.org/files/2009/03/dif_low.gif" alt="dif_low" width="100" height="20" /></p>
<p style="text-align: left">It is very useful to show some random posts after the current reading post. You online need one litle function for that:</p>
<p><span id="more-35"></span></p>
<p style="text-align: left"><div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> get_random_posts <span style="color: #009900;">&#40;</span>$number_of_posts<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">global $wpdb, $post;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$current_post = get_the_title();</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$random_posts = $wpdb-&gt;get_results(&quot;SELECT $wpdb-&gt;posts.ID, \</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">post_title, post_name, post_date, post_type, post_status FROM \</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$wpdb-&gt;posts WHERE post_type = 'post' AND post_status = 'publish' \</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">AND post_title != '$current_post' ORDER BY RAND() limit \</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$number_of_posts&quot;);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">foreach ($random_posts as $post) {</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$post_title = htmlspecialchars(stripslashes($post-&gt;post_title));</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">echo &quot;&lt;li&gt;&lt;a href=\&quot;&quot;.get_permalink().&quot;\&quot;&gt;$post_title&lt;/a&gt;&lt;/li&gt;&quot;;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div></p>
<p style="text-align: left">How this works?</p>
<ol>
<li>Get the current post title with &#8220;$current_post = get_the_title();&#8221; because, we won&#8217;t show this title again</li>
<li>Get x random posts &#8220;&#8230;$random_posts = $wpdb-&gt;get_results&#8230;&#8221;</li>
<li>Go trought each post, get its title and show it &#8220;foreach ($random_posts as $post)&#8230;&#8221;</li>
</ol>
<p>That&#8217;s all! Have Fun!</p>
<p style="text-align: left">
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress/how-to-show-random-posts-after-current-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change autosave interval and limit revisions</title>
		<link>http://coding.my-guide.org/wordpress/change-autosave-interval-and-limit-revisions/</link>
		<comments>http://coding.my-guide.org/wordpress/change-autosave-interval-and-limit-revisions/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 11:28:38 +0000</pubDate>
		<dc:creator>Bako</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[autosave interval]]></category>
		<category><![CDATA[limit revisions]]></category>
		<category><![CDATA[wp-config.php]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=33</guid>
		<description><![CDATA[Difficulty Level: Today we will show you how to change auto save time interval in wordpress and how to limit post revisions.  This is very simple. You only have to change your wp-config.php To change auto save interval you have to put this line in your wp-config.php: Replace [DURATION_IN_SECONDS] with your desired number of seconds. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Difficulty Level:</p>
<p style="text-align: left"><img class="alignnone size-full wp-image-27" src="http://coding.my-guide.org/files/2009/03/dif_low.gif" alt="dif_low" width="100" height="20" /></p>
<p style="text-align: justify">Today we will show you how to change auto save time interval in wordpress and how to limit post revisions.  This is very simple. You only have to change your wp-config.php</p>
<p style="text-align: justify">To change auto save interval you have to put this line in your wp-config.php:</p>
<p style="text-align: justify"><div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">define<span style="color: #009900;">&#40;</span>’AUTOSAVE_INTERVAL’<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>DURATION_IN_SECONDS<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;</div></li></ol></pre></div></div></p>
<p style="text-align: justify">Replace [DURATION_IN_SECONDS] with your desired number of seconds.</p>
<p style="text-align: justify">To limit revision posts you have to put this line into your wp-config.php:</p>
<p><span id="more-33"></span></p>
<p style="text-align: justify"><div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">define <span style="color: #009900;">&#40;</span>’WP_POST_REVISIONS’<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>NUMBER_OF_REVISION<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;</div></li></ol></pre></div></div></p>
<p style="text-align: justify">If you replace [NUMBER_OF_REVISION] with &#8220;0&#8243; (zero), no more revisions will be saved. Otherwise replace [NUMBER_OF_REVISION] with your desired number of revisions for each post.</p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress/change-autosave-interval-and-limit-revisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check if your main blog page is being displayed.</title>
		<link>http://coding.my-guide.org/wordpress/how-to-check-if-your-main-blog-page-is-being-displayed/</link>
		<comments>http://coding.my-guide.org/wordpress/how-to-check-if-your-main-blog-page-is-being-displayed/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 14:15:20 +0000</pubDate>
		<dc:creator>Ibro</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[conditional tag]]></category>
		<category><![CDATA[is_home()]]></category>
		<category><![CDATA[main]]></category>
		<category><![CDATA[more information]]></category>
		<category><![CDATA[page]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=32</guid>
		<description><![CDATA[Difficulty Level: Sometimes it is usefull to display other information on your main blog page. WordPress provides a conditional tag called &#8220;is_home()&#8221;. This tag detects if you are on the main blog page, so you are able to display other or more information on the main blog page. Description: We use the conditional tag &#8220;is_home()&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Difficulty Level:</p>
<p style="text-align: left"><img class="alignnone size-full wp-image-27" src="http://coding.my-guide.org/files/2009/03/dif_low.gif" alt="dif_low" width="100" height="20" /></p>
<p>Sometimes it is usefull to display other information on your main blog page. WordPress provides a conditional tag called <em>&#8220;is_home()&#8221;</em>. This tag detects if you are on the main blog page, so you are able to display other or more information on the main blog page.</p>
<p><span id="more-32"></span><div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;?php</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Check if you are on the main page</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// get all catogery id's</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$catIDs = get_all_category_ids();</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// get all post with the first category id</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">query_posts('cat=' . $catIDs[0]);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">?&gt;</div></li></ol></pre></div></div></p>
<p>Description:</p>
<ol>
<li>We use the conditional tag <em>&#8220;is_home()&#8221;</em> to detect if we are on the main page.</li>
<li>Then we get all category id&#8217;s.</li>
<li>We look for posts with the first category id.</li>
</ol>
<p style="text-align: justify">You can download this example here.</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/main_blog.zip"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress/how-to-check-if-your-main-blog-page-is-being-displayed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to show 6 posts from each category on index page</title>
		<link>http://coding.my-guide.org/wordpress/how-to-show-6-posts-from-each-category-on-index-page/</link>
		<comments>http://coding.my-guide.org/wordpress/how-to-show-6-posts-from-each-category-on-index-page/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 13:53:51 +0000</pubDate>
		<dc:creator>Bako</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[get_categories]]></category>
		<category><![CDATA[get_category_link]]></category>
		<category><![CDATA[get_posts]]></category>
		<category><![CDATA[index page]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=29</guid>
		<description><![CDATA[Difficulty Level: On this tutorial I will show you how to make this on your wordpress index page: If you wish to show a defined number of posts from each category on your index page, you can do it like this: Explanation: Get all categories: &#8220;$categories = get_categories(); &#8220; Go trough each category and get [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Difficulty Level:</p>
<p style="text-align: left"><img class="alignnone size-full wp-image-27" src="http://coding.my-guide.org/files/2009/03/dif_low.gif" alt="dif_low" width="100" height="20" /></p>
<p style="text-align: justify">On this tutorial I will show you how to make this on your wordpress index page:</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/2009/03/cat_view.png"><img class="size-medium wp-image-28 aligncenter" src="http://coding.my-guide.org/files/2009/03/cat_view-300x195.png" alt="cat_view" width="300" height="195" /></a></p>
<p style="text-align: justify">If you wish to show a defined number of posts from each category on your index page, you can do it like this:</p>
<p><span id="more-29"></span></p>
<p style="text-align: justify"><div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;?php</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">global $post;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$categories <span style="color: #339933;">=</span> get_categories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">foreach <span style="color: #009900;">&#40;</span>$categories as $category<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$cat_id = $category-&gt;cat_ID;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$games = get_posts('numberposts=6&amp;orderby=rand&amp;category='.$cat_id);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ($games) {</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">echo '&lt;div class=&quot;category&quot;&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">echo '&lt;h1&gt;&lt;a href=&quot;'.get_category_link($cat_id).'&quot;&gt;' \</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">.$category-&gt;name. '&lt;/a&gt;&lt;/h1&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">foreach ($games as $post) {</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">?&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">&lt;div class=&quot;game_title&quot;&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot;  \</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">title=&quot;&lt;?php the_title(); ?&gt;&quot; &gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">&lt;?php if ((strlen($post-&gt;post_title) &gt; 10)) { \</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">echo substr($post-&gt;post_title, 0, 10).&quot;..&quot;; }</span> <span style="color: #000000; font-weight: bold;">else</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; ?&gt;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;br&gt;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;img src <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&lt;?php echo get_post_meta($post-&gt;ID, &quot;</span>thumbnail_url<span style="color: #ff0000;">&quot;, <span style="color: #000099; font-weight: bold;">\</span></span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">true);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">?&gt;&quot;</span> width<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;85&quot;</span> height<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;85&quot;</span>&gt;&lt;<span style="color: #339933;">/</span>a&gt;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;<span style="color: #339933;">/</span>div&gt;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;?php</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo <span style="color: #ff0000;">'&lt;div class=&quot;cat_link&quot;&gt;&lt;a href=&quot;'</span>.<span style="color: #0066ee;">get_category_link</span><span style="color: #009900;">&#40;</span>$cat_id<span style="color: #009900;">&#41;</span>.<span style="color: #ff0000;">'&quot;&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">\ More Games&lt;/a&gt;&lt;/div&gt;'</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo <span style="color: #ff0000;">'&lt;/div&gt;'</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">?&gt;</div></li></ol></pre></div></div></p>
<p style="text-align: justify">Explanation:</p>
<ul>
<li>Get all categories: &#8220;$categories = get_categories(); &#8220;</li>
<li>Go trough each category and get 6 random posts: &#8220;foreach ($categories as $category)&#8221; &#8230; &#8220;get_posts(&#8216;numberposts=6&amp;orderby=rand&amp;category=&#8217;.$cat_id);&#8221;</li>
<li>Get each post and show it: &#8220;foreach ($games as $post)&#8221; &#8230;</li>
</ul>
<p>You can download this example here:</p>
<p style="text-align: center"><a title="Show category posts on index page" href="http://coding.my-guide.org/files/cat_posts.rar"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress/how-to-show-6-posts-from-each-category-on-index-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check if your Apache Webserver is still running</title>
		<link>http://coding.my-guide.org/linux/how-to-check-if-your-apache-webserver-is-still-running/</link>
		<comments>http://coding.my-guide.org/linux/how-to-check-if-your-apache-webserver-is-still-running/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 15:45:41 +0000</pubDate>
		<dc:creator>Ibro</dc:creator>
				<category><![CDATA[Bash Scripting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[deamon]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[start]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=26</guid>
		<description><![CDATA[Difficulty Level: If you have a apache webserver running on a linux machine sometimes it happens that the webserver crashs. This could have many reasons, but still there is the problem your site isn&#8217;t reachable. How can we solve this problem? An easy way to check the apache deamon is in wiriting a small bash [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Difficulty Level:</p>
<p style="text-align: left"><img class="alignnone size-full wp-image-27" src="http://coding.my-guide.org/files/2009/03/dif_low.gif" alt="dif_low" width="100" height="20" /></p>
<p style="text-align: justify">If you have a apache webserver running on a linux machine sometimes it happens that the webserver crashs. This could have many reasons, but still there is the problem your site isn&#8217;t reachable. How can we solve this problem?</p>
<p style="text-align: justify"><span id="more-26"></span>An easy way to check the apache deamon is in wiriting a small bash script. You can run the script every hour in a cron job.</p>
<p style="text-align: justify">So what is this script doing?</p>
<ol style="text-align: justify">
<li>First we check if the apache deamon is running.</li>
<li>If the apache deamon is running we do nothing.</li>
<li>If the apache deamon isn&#8217;t running we start the deamon again.</li>
<li>After the start, we check again if the deamon was successfully started</li>
</ol>
<p style="text-align: left"><div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"># look <span style="color: #000000; font-weight: bold;">if</span> the apache deamon is running</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">apacha_alive<span style="color: #339933;">=</span>`ps <span style="color: #339933;">-</span>eaf |grep apache2 |grep <span style="color: #339933;">-</span>v grep |wc <span style="color: #339933;">-</span>l`</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#91;</span> <span style="color: #ff0000;">&quot;$apacha_alive&quot;</span> <span style="color: #339933;">-</span>lt <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #009900;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"># Apache is <span style="color: #000000; font-weight: bold;">not</span> running</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"># Start Apache Deamon</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>init.<span style="color: #0066ee;">d</span><span style="color: #339933;">/</span>apache2 start</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"># Check <span style="color: #000000; font-weight: bold;">if</span> start was successful</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">apacha_alive<span style="color: #339933;">=</span>`ps <span style="color: #339933;">-</span>eaf |grep apache2 |grep <span style="color: #339933;">-</span>v grep |wc <span style="color: #339933;">-</span>l`</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#91;</span> <span style="color: #ff0000;">&quot;$apacha_alive&quot;</span> <span style="color: #339933;">-</span>lt <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #009900;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo <span style="color: #ff0000;">&quot;Apache couldn't be started&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo <span style="color: #ff0000;">&quot;Apache successfully started&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">fi</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo <span style="color: #ff0000;">&quot;Apache is already running&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">fi</div></li></ol></pre></div></div></p>
<p style="text-align: justify">You can also download this bash script.</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/apache_check.zip"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/linux/how-to-check-if-your-apache-webserver-is-still-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a gallery of your available themes?</title>
		<link>http://coding.my-guide.org/wordpress-mu/how-to-create-a-gallery-of-your-available-themes/</link>
		<comments>http://coding.my-guide.org/wordpress-mu/how-to-create-a-gallery-of-your-available-themes/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 14:47:54 +0000</pubDate>
		<dc:creator>Ibro</dc:creator>
				<category><![CDATA[Wordpress MU]]></category>
		<category><![CDATA[available]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[worpress-mu]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=22</guid>
		<description><![CDATA[Difficulty Level: Hello and welcome to a new small tutorial about wordpress-mu plugins. This tutorial is build on a previous tutorial &#8220;How to use a plugin function in a post?&#8220;. The main focus is to how to create a nice table to present your themes in a gallery. So this is what you need: Function [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Difficulty Level:</p>
<p style="text-align: left"><img class="size-full wp-image-21 alignleft" src="http://coding.my-guide.org/files/2009/02/dif_low-mid.gif" alt="dif_low-mid" width="100" height="20" /></p>
<p style="text-align: left">
<p style="text-align: justify">
<p>Hello and welcome to a new small tutorial about wordpress-mu plugins. This tutorial is build on a previous tutorial &#8220;<a href="http://coding.my-guide.org/wordpress-mu/how-to-use-a-plugin-function-in-a-post/" target="_blank">How to use a plugin function in a post?</a>&#8220;. The main focus is to how to create a nice table to present your themes in a gallery.</p>
<p>So this is what you need:<br />
<span id="more-22"></span></p>
<p>Function 1:<br />
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> mg_show_gallery_available_themes<span style="color: #009900;">&#40;</span>$match<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Clear output</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output ='';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$colcount   = 2;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// picture settings</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$imgwidth   = 'width=&quot;300px&quot;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$imgheight  = 'height=&quot;225px&quot;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$cellheight = 'height=&quot;250px&quot;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Get all theme information</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$themes       = get_themes();</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// count the available themes</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$theme_total  = count( $themes );</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$theme_names  = array_keys($themes);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Calculate the necessary rows</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$rows = ceil(count($theme_names) / $colcount);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">for ( $row = 1; $row &lt;= $rows; $row++ ) {</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">for ( $col = 1; $col &lt;= $colcount; $col++ ) {</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$table[$row][$col] = array_shift($theme_names);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// table &quot;START&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$output .<span style="color: #339933;">=</span> <span style="color: #ff0000;">'&lt;table width=&quot;100%&quot; border=&quot;0&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000;">cellspacing=&quot;5&quot; cellpadding=&quot;0&quot;&gt;'</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">foreach <span style="color: #009900;">&#40;</span> $table as $row <span style="color: #339933;">=</span>&gt; $cols <span style="color: #009900;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;tr align=&quot;center&quot; ' . $cellheight . '&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">foreach ( $cols as $col =&gt; $theme_name ) {</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$class = array('available-theme');</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Define the postion</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ( $row == 1 ) $class[] = 'top';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ( $col == 1 ) $class[] = 'left';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ( $row == $rows ) $class[] = 'bottom';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ( $col == 3 ) $class[] = 'right';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;td class=&quot;'. join(' ', $class) . $cellwidth . '&quot;&gt;';</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ( !empty($theme_name) ) :</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$template = $themes[$theme_name]['Template'];</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$title = $themes[$theme_name]['Title'];</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$screenshot = $themes[$theme_name]['Screenshot'];</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$thickbox_class = 'thickbox';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Write theme name</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;h3&gt;' . $title . '&lt;/h3&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Build your image link to a screenshot</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if ( $screenshot )</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;image src=&quot;' .WP_CONTENT_URL . $stylesheet_dir .</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">'/' . $screenshot .'?&gt;&quot;' . $imgwidth . $imgheight .'alt=&quot;'.</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$title .'&quot;&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// There is no screenshot available</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= 'No screenshot available..';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">endif;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$output .<span style="color: #339933;">=</span> <span style="color: #ff0000;">'&lt;/td&gt;'</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$output .<span style="color: #339933;">=</span> <span style="color: #ff0000;">'&lt;/tr&gt;'</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// table &quot;END&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$output .<span style="color: #339933;">=</span> <span style="color: #ff0000;">'&lt;/table&gt;'</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">return<span style="color: #009900;">&#40;</span>$output<span style="color: #009900;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div></p>
<p>Function 2:</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">/***</span>H<span style="color: #339933;">*</span>O<span style="color: #339933;">*</span>O<span style="color: #339933;">*</span>K<span style="color: #339933;">******************************************/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'embeddedshow_list_available_themes'</span><span style="color: #009900;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">/****************************************************/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// actual plugin function</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> embeddedshow_list_available_themes<span style="color: #009900;">&#40;</span>$content<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output = preg_replace_callback('[mg_call_show_list_available_themes]'</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">,'mg_show_gallery_available_themes', $content);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">return ($output);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li></ol></pre></div></div><br />
<strong>Description:</strong></p>
<ol>
<li>We define setting for the table. How big are the thumbnails in you gallery and how many columns we want to have.</li>
<li>Now we have to look how much themes are available and calculate how much rows we will need.</li>
<li>Start creating the rows and columns and filling the cells of the table with the theme name and screenshot thumbnail.</li>
<li>If there is no screenshot available we will show a &#8220;No screenshot available..&#8221; message.</li>
<li>Ending the table.</li>
<li>The last thing you have to do is to insert the string &#8220;mg_call_show_gallery_available_themes&#8221; in a post.</li>
</ol>
<p><strong>Result:</strong></p>
<p style="text-align: center"><a rel="lightbox" href="http://coding.my-guide.org/files/2009/02/gallery-screen1.jpg"><img class="aligncenter size-full wp-image-25" src="http://coding.my-guide.org/files/2009/02/gallery-screen1.jpg" alt="gallery-screen1" width="330" height="359" /></a></p>
<p style="text-align: justify">You can also download this wordpress mu plugin.</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/mg_gallery_themes.zip"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress-mu/how-to-create-a-gallery-of-your-available-themes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Theme Preview Maker</title>
		<link>http://coding.my-guide.org/tools/wordpress-theme-preview-maker/</link>
		<comments>http://coding.my-guide.org/tools/wordpress-theme-preview-maker/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 11:01:58 +0000</pubDate>
		<dc:creator>Bako</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[freeware]]></category>
		<category><![CDATA[Preview]]></category>
		<category><![CDATA[Screenshots]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Thumbnails]]></category>
		<category><![CDATA[Tool]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress MU]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=18</guid>
		<description><![CDATA[Do you have a WordPress Theme collection? Have you ever tried to upload more than 10 themes on your server just to view the thumbnails? This produces unnecessary traffic, waste your time and takes a while until WordPress gets the thumbnails. One other way to see all thumbnails is to open each directory and take [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify">Do you have a WordPress Theme collection? Have you ever tried to upload more than 10 themes on your server just to view the thumbnails? This produces unnecessary traffic, waste your time and takes a while until WordPress gets the thumbnails. One other way to see all thumbnails is to open each directory and take a look on every  screenshot image. Is this what you do? Yes?! Are you kidding? <img src='http://coding.my-guide.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: justify">I was looking for a solution to crack this problem. Unfortunately I didn&#8217;t found a anything appropriate. So I created a simple tool. This tool scans a directory which contains your theme collection and creates a HTML page with all thumbnails. So I don&#8217;t have to upload all themes to my server only to look over  all thumbnails. I call it &#8220;WordPress Theme Preview Maker&#8221;!</p>
<p style="text-align: center"><a rel="lightbox" href="http://coding.my-guide.org/files/2009/02/preview-maker.png"><img class="size-medium wp-image-19 aligncenter" src="http://coding.my-guide.org/files/2009/02/preview-maker-300x242.png" alt="preview-maker" width="300" height="242" /></a></p>
<p style="text-align: justify">You can download and use &#8220;WordPress Theme Preview Maker&#8221; for free. You can share it with your friends or others. Do not SELL!<span id="more-18"></span></p>
<p style="text-align: center"><a title="My-Guide Theme Preview Maker" href="http://coding.my-guide.org/files/Theme Preview Maker.zip"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
<p>To run WordPress Theme Preview Maker you need Microsoft .NET Framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/tools/wordpress-theme-preview-maker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use a plugin function in a post?</title>
		<link>http://coding.my-guide.org/wordpress-mu/how-to-use-a-plugin-function-in-a-post/</link>
		<comments>http://coding.my-guide.org/wordpress-mu/how-to-use-a-plugin-function-in-a-post/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 15:14:16 +0000</pubDate>
		<dc:creator>Ibro</dc:creator>
				<category><![CDATA[Wordpress MU]]></category>
		<category><![CDATA[add_filter]]></category>
		<category><![CDATA[add_filter('the_content']]></category>
		<category><![CDATA[call]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[the_content]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=15</guid>
		<description><![CDATA[Difficulty Level: Today we will show you how to use your own plugin function in a post. Sometimes you want to add special content to your post, but there is no wordpress function available. An easy way to solve this problem is to write your own function, which will do what you want and include [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify">Difficulty Level:<br />
<img class="alignnone size-full wp-image-21" src="http://coding.my-guide.org/files/2009/02/dif_low-mid.gif" alt="dif_low-mid" width="100" height="20" /></p>
<p style="text-align: justify">Today we will show you how to use your own plugin function in a post.</p>
<p style="text-align: justify">Sometimes you want to add special content to your post, but there is no wordpress function available. An easy way to solve this problem is to write your own function, which will do what you want and include it into your post with a special tag. In our example we will use a function which shows a list of all available themes.</p>
<p style="text-align: justify">In four small steps we will reach our goal:<br />
<span id="more-15"></span><br />
<strong>Step 1:</strong><br />
Create a php file. Name it &#8220;mg_plugin_post.php&#8221;.</p>
<p style="text-align: justify"><strong>Step 2:</strong><br />
Now you have to insert this two small functions:</p>
<p style="text-align: justify">Funtion 1:</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> mg_show_list_available_themes<span style="color: #009900;">&#40;</span>$match<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Clear output</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output ='';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Get all theme information</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$themes   = get_themes();</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Get all Theme names</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$theme_names  = array_keys($themes);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Create the output</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output = 'List of all available themes:';</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;ul&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">//Write every theme name in a list element</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">foreach($theme_names as $my_themes)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;li&gt;' .$my_themes .'&lt;/li&gt;';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output .= '&lt;/ul&gt;';</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Return the whole output string</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">return($output);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li></ol></pre></div></div><br />
Function 2:<br />
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">/***</span>H<span style="color: #339933;">*</span>O<span style="color: #339933;">*</span>O<span style="color: #339933;">*</span>K<span style="color: #339933;">*************************************/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'embeddedshow_list_available_themes'</span><span style="color: #009900;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">/***********************************************/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// actual plugin function</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> embeddedshow_list_available_themes<span style="color: #009900;">&#40;</span>$content<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$output=preg_replace_callback('[mg_call_show_list_available_themes]',</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">'mg_show_list_available_themes', $content);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">return ($output);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li></ol></pre></div></div>
<p><strong>Step 3:</strong><br />
Copy this file in your mu-plugins directory.</p>
<p><strong>Step 4:</strong><br />
Create a new post and the content of your post will be <em>mg_call_show_list_available_themes</em>.</p>
<p>Now you will get a list of all themes in your post.</p>
<p style="text-align: justify"><strong>How did we do that?</strong></p>
<ol style="text-align: justify">
<li>In &#8220;Function 2&#8243; we use a filter to call a function <em>embeddedshow_list_available_themes</em> when content of your blog will be generated.</li>
<li>In this function we use the php function <em>preg_replace_callback</em> to search the content for the special string <em>mg_call_show_list_available_themes</em>. So if we find that string we will call a new function.</li>
<li>In this case the &#8220;Function 1&#8243; <em>mg_show_list_available_themes</em> which will generate the list of all available themes and return it to &#8220;Function 2&#8243;.</li>
<li>The funtion <em>embeddedshow_list_available_themes</em> replaces the string <em>mg_call_show_list_available_themes</em> in your post with the new content generated by &#8220;Function 1&#8243;.</li>
</ol>
<p style="text-align: justify">You can also download this wordpress mu plugin.</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/mg_plugin_post.zip"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress-mu/how-to-use-a-plugin-function-in-a-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove post revisions?</title>
		<link>http://coding.my-guide.org/wordpress-mu/how-to-remove-post-revisions/</link>
		<comments>http://coding.my-guide.org/wordpress-mu/how-to-remove-post-revisions/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 10:00:27 +0000</pubDate>
		<dc:creator>Bako</dc:creator>
				<category><![CDATA[Wordpress MU]]></category>
		<category><![CDATA[clean revisions]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[optimize]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[revisions]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://coding.my-guide.org/?p=14</guid>
		<description><![CDATA[We will show you today how to remove existing post revisions from all blogs. This is a very simple about 20-LOC-script (LOC = Lines Of Code) How should it work? Create a menu entry Check if the user has enough rights to run this script Get a list of all blogs Go to each post [...]]]></description>
			<content:encoded><![CDATA[<p>We will show you today how to remove existing post revisions from all blogs. This is a very simple about <strong>20-LOC-script</strong> (LOC = Lines Of Code) <img src='http://coding.my-guide.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>How should it work?</p>
<ul>
<li>Create a menu entry</li>
<li>Check if the user has enough rights to run this script</li>
<li>Get a list of all blogs</li>
<li>Go to each post table and delete posts marked as &#8220;revision&#8221;</li>
</ul>
<h3>Create a menu entry</h3>
<p>First you have to create a file named &#8220;mg_clean_revisions.php&#8221;. Open the file to put some code into it. At first we need a hook which will be called when you access the admin menu. This hook should run a function which creates a menu entry.<span id="more-14"></span></p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// H O O K</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_action<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'mg_clean_revisions_menu'</span><span style="color: #009900;">&#41;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Create menu entry</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> mg_clean_revisions_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">add_submenu_page('wpmu-admin.php', 'Clean Revisions',</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">'Clean Revisions', 1, 'mg_clean_revisions.php', 'mg_clean_revisions');</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li></ol></pre></div></div>
<p>A menu entry &#8220;Clean Revisions&#8221; will be created. When you click on this menu, the script will call a function named &#8220;mg_clean_revisions&#8221;. Now we have to implement this function. When this function is called we should check if the user has enough access rights to do this. Then we need a list of all blogs that we can delete posts marked as &#8220;revision&#8221;.</p>
<p><div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="pascal" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> mg_clean_revisions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">global $wpdb;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">echo &quot;&lt;h1&gt;My-Guide's Clean Revisions&lt;/h1&gt;&quot;;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Check Whether User Can Manage Database</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">if(!current_user_can('manage_database')) {</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">die('Access Denied');</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Get all blogs</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$blog_list <span style="color: #339933;">=</span> $wpdb<span style="color: #339933;">-</span>&gt;get_results<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;SELECT blog_id FROM $wpdb-&gt;blogs&quot;</span><span style="color: #009900;">&#41;</span>;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">// Go trough all blogs and delete revisions</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">foreach <span style="color: #009900;">&#40;</span>$blog_list as $blog<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">{</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$table = $wpdb-&gt;base_prefix . $blog-&gt;blog_id . '_posts';</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">$wpdb-&gt;query(&quot;DELETE FROM $table WHERE post_type = 'revision'&quot;);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">print &quot;Cleaning: &quot; . $table . &quot; ..done&lt;br&gt;&quot;;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">}</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo <span style="color: #ff0000;">&quot;&lt;br&gt;&lt;strong&gt;All revisions deleted.&lt;/strong&gt;&quot;</span>;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div>You can also download this wordpress mu plugin.</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/mg_clean_revisions.rar"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress-mu/how-to-remove-post-revisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change WordPress Login Logo</title>
		<link>http://coding.my-guide.org/wordpress-mu/change-wordpress-login-logo/</link>
		<comments>http://coding.my-guide.org/wordpress-mu/change-wordpress-login-logo/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 18:52:40 +0000</pubDate>
		<dc:creator>Bako</dc:creator>
				<category><![CDATA[Wordpress MU]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[logo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://conding.my-guide.org/?p=6</guid>
		<description><![CDATA[At first I would like to show you, how to replace the standard wordpress logo on your login page. This is very simple. All we have to do is to replace the background image at &#60;h1&#62; stylesheet. Let&#8217;s go: Create a new css file. I will name this file &#8220;mg_login_style.css&#8221;. Add this few lines: Now, [...]]]></description>
			<content:encoded><![CDATA[<p>At first I would like to show you, how to replace the standard wordpress logo on your login page.</p>
<p style="text-align: center"><a rel="lightbox" href="http://coding.my-guide.org/files/2009/02/wp_login_form.png"><img class="size-thumbnail wp-image-7 aligncenter" src="http://coding.my-guide.org/files/2009/02/wp_login_form-150x150.png" alt="wp_login_form" width="150" height="150" /></a></p>
<p style="text-align: left">This is very simple. All we have to do is to replace the background image at &lt;h1&gt; stylesheet. Let&#8217;s go:<span id="more-6"></span></p>
<p style="text-align: left">Create a new css file. I will name this file &#8220;mg_login_style.css&#8221;. Add this few lines:</p>
<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_13"></a><a id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13"  onClick="javascript:wpsh_toggleBlock(13)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_13" onClick="javascript:wpsh_code(13)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_13" onClick="javascript:wpsh_print(13)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display: block;"><pre class="css" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">h1 a <span style="color: #00AA00;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mg_login_logo.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">326px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">text-indent</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-9999px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #00AA00;">&#125;</span></div></li></ol></pre></div></div>
<p>Now, you have to create your own logo with transparent background. Name your logo &#8220;mg_login_logo.png&#8221;, because we&#8217;ve defined it&#8217;s name at this line: <div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_14"></a><a id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14"  onClick="javascript:wpsh_toggleBlock(14)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_14" onClick="javascript:wpsh_code(14)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_14" onClick="javascript:wpsh_print(14)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display: block;"><pre class="css" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mg_login_logo.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span></div></li></ol></pre></div></div></p>
<p>At this moment, you should have two files, one logo image and one css-file. Finaly, you have to create a hook to replace the original logo. We need a new file. Name it &#8220;mg_login.php&#8221;. This php script contains one function, which prints your css file into login page and one hook which is called, when someone will login.</p>
<p>The code below shows, how it works on wordpress mu (wpmu). For &#8220;normal&#8221; wordpress you have to replace &#8220;mu-plugins&#8221; with &#8220;plugins&#8221;.</p>
<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_15"></a><a id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15"  onClick="javascript:wpsh_toggleBlock(15)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_15" onClick="javascript:wpsh_code(15)" title="Show code only"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_15" onClick="javascript:wpsh_print(15)" title="Print code"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://coding.my-guide.org/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">function mg_login() {</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">$csslocation = get_settings('siteurl')</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">. '/wp-content/mu-plugins/mg_login_style.css';</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">// print the css file</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo '&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;'</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">. $csslocation . '&quot; /&gt;';</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">}</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">/* H O O K */</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">add_action('login_head', 'mg_login');</div></li></ol></pre></div></div>
<p style="text-align: center"><a rel="lightbox" href="http://coding.my-guide.org/files/2009/02/wp_login_form_new.png"><img class="size-thumbnail wp-image-12 aligncenter" src="http://coding.my-guide.org/files/2009/02/wp_login_form_new-150x150.png" alt="wp_login_form_new" width="150" height="150" /></a></p>
<p style="text-align: left">Here you can download this wordpress mu plugin:</p>
<p style="text-align: center"><a href="http://coding.my-guide.org/files/mg_login.rar"><img class="aligncenter" src="http://coding.my-guide.org/files/download_now.png" alt="" /></a></p>
<p style="text-align: left"> </p>
]]></content:encoded>
			<wfw:commentRss>http://coding.my-guide.org/wordpress-mu/change-wordpress-login-logo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

