<?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>Christian Schenk&#187; plugin</title>
	<atom:link href="http://www.christianschenk.org/blog/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christianschenk.org</link>
	<description>Writing about my experiences with technology and all different kinds of projects and experiments</description>
	<lastBuildDate>Sun, 29 Aug 2010 09:08:16 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress: is_child function</title>
		<link>http://www.christianschenk.org/blog/wordpress-is_child-function/</link>
		<comments>http://www.christianschenk.org/blog/wordpress-is_child-function/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 06:10:48 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[is_child]]></category>
		<category><![CDATA[is_tree]]></category>
		<category><![CDATA[parent]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/?p=735</guid>
		<description><![CDATA[Every once in a while I would like to test whether the current page is a descendant of another page. This is particularly useful if you want to display certain content on a subset of your pages only. Although the Codex suggests a similar is_tree function I would like to present an extended version here.
I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while I would like to test whether the current page is a descendant of another page. This is particularly useful if you want to display certain content on a subset of your pages only. Although the <a href="http://codex.wordpress.org/">Codex</a> suggests a similar <code>is_tree</code> function I would like to present an extended version here.</p>
<p>I&#8217;ve packaged the functionality inside a WordPress plugin called is_child that you can download <a href="http://data.christianschenk.org/wordpress-is_child-function/ischild.php.zip">here</a>. Unzip it, upload it to <code>wp-content/plugins</code> and activate the plugin.</p>
<p><span id="more-735"></span></p>
<h2>Coding is_child</h2>
<p>Doing a quick web search brings up tons of sites providing some sort of <code>is_child</code> or <code>is_tree</code> function. Most of the time it&#8217;s something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> is_child<span style="color: #009900;">&#40;</span><span style="color: #000088;">$parent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$parent</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is great and a pretty nice solution. I&#8217;ve taken this approach and extended it with the following functionality:</p>
<ul>
<li>by default we&#8217;ll retrieve all parent pages up to the root node and test whether the current page is part of this tree. This behavior can be disabled though.</li>
<li>you can supply the name (<em>slug</em>) of a post/page instead of the ID and the function will look it up for you.</li>
</ul>
<p>All this combined with some error checking makes a great idea even better. Just have a look at the code if you would like to know more about the exact implementation.</p>
<h2>Conclusion</h2>
<p>We&#8217;ve seen that it&#8217;s very easy to test whether the current page is a child of another page or part of a certain tree in your page hierarchy. Packaging this into a plugin or placing the necessary code into your theme&#8217;s <code>functions.php</code> allows you to display certain content on particular pages only. In case you&#8217;re using the <a href="http://wordpress.org/extend/plugins/widget-logic/">Widget logic</a> plugin you now can display widgets on pages belonging to a particular subtree of your pages only, which is great.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/wordpress-is_child-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress: Add notes to the comment form</title>
		<link>http://www.christianschenk.org/blog/wordpress-add-notes-comment-form/</link>
		<comments>http://www.christianschenk.org/blog/wordpress-add-notes-comment-form/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 07:10:19 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[fields]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/?p=727</guid>
		<description><![CDATA[Most themes use the comment_form action which can be used to add arbitrary things to the comment form with a plugin. This post presents a simple plugin that uses custom fields to add special notes to this section.
You can download the plugin here, unzip it, upload it to your wp-content/plugins directory and activate it.

How to
Using [...]]]></description>
			<content:encoded><![CDATA[<p>Most themes use the <code>comment_form</code> action which can be used to add arbitrary things to the comment form with a plugin. This post presents a simple plugin that uses custom fields to add special notes to this section.</p>
<p>You can download the plugin <a href="http://data.christianschenk.org/wordpress-add-notes-comment-form/comment-form-notes.php.zip">here</a>, unzip it, upload it to your <code>wp-content/plugins</code> directory and activate it.</p>
<p><span id="more-727"></span></p>
<h2>How to</h2>
<p>Using this plugin is super simple: just add a custom field named <code>cnote</code> to a post/page and enter the content that should appear next to the comment form into its value field.</p>
<p>Here&#8217;s an example:</p>
<p><img src="/wp-content/uploads/cnote_cf.png" alt="Custom Field" title="cnote_cf" width="473" height="70" class="size-full wp-image-728" /></p>
<p>When WordPress renders the page, the plugin will pick up the content of your custom field and display its content next to your comment form. It may look like so:</p>
<p><img src="/wp-content/uploads/cnote_result.png" alt="Result" title="cnote_result" width="254" height="87" class="size-full wp-image-729" /></p>
<p>The plugin expects that you enter some text, so it inserts your content into a <code>p</code> element. This element has got a class <code>cnote</code> helping you to style the notes with CSS.</p>
<h2>The code</h2>
<p>In case you&#8217;re developer and want to know more about the code just have a look at the plugin, it&#8217;s really straight forward. What it does is this: look out for a custom field named <em>cnote</em>, if it&#8217;s present we&#8217;ll output it&#8217;s contents otherwise nothing happens.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$note</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cnote'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$note</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$note</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span></pre></div></div>

<p>This gets registered with the <code>comment_form</code> action and will be executed once the theme calls this action.</p>
<h2>Conclusion</h2>
<p>Using custom fields we can add hints to comment forms on a post/page basis. This technique may be really helpful in case you would like to tell the user something special just before he fills out the comment form.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/wordpress-add-notes-comment-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate quiz for Contact Form 7</title>
		<link>http://www.christianschenk.org/blog/generate-quiz-contact-form-7/</link>
		<comments>http://www.christianschenk.org/blog/generate-quiz-contact-form-7/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 16:50:16 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[cf7]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[quiz]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/?p=691</guid>
		<description><![CDATA[If you&#8217;re using Contact Form 7 for WordPress you might want to protect your forms with a quiz: this is a field where the user has to enter the result of predefined questions. Since we don&#8217;t want to annoy the user with a complicated task we&#8217;d like to generate very easy to answer questions.

Generating the [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using <a href="http://wordpress.org/extend/plugins/contact-form-7/">Contact Form 7</a> for WordPress you might want to protect your forms with a <em>quiz</em>: this is a field where the user has to enter the result of predefined questions. Since we don&#8217;t want to annoy the user with a complicated task we&#8217;d like to generate very easy to answer questions.</p>
<p><span id="more-691"></span></p>
<h2>Generating the quiz</h2>
<p>We&#8217;re going to generate very easy mathematical equations to prevent spam bots from filling out the form. To make things really easy we ask the user to add two numbers where the sum is always smaller than ten. This way it&#8217;s a matter of a second to fill out the quiz and the user can complete the form really fast.</p>
<p>Here&#8217;s a small shell script that generates the necessary code for the quiz tag.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">1</span> <span style="color: #000000;">9</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #000000; font-weight: bold;">for</span> j <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">1</span> <span style="color: #000000;">9</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">sum</span></span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$i</span> + <span style="color: #007800;">$j</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #007800;">$sum</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">9</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">continue</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$i</span>+<span style="color: #007800;">$j</span>=?|<span style="color: #007800;">$sum</span><span style="color: #000099; font-weight: bold;">\&quot;</span> &quot;</span>
  <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">echo</span></pre></div></div>

<p>The same script in Perl can be easily executed with <code>perl -e</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$j</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$j</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #0000ff;">$sum</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$i</span><span style="color: #339933;">+</span><span style="color: #0000ff;">$j</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">next</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$sum</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>$i+$j=?|$sum<span style="color: #000099; font-weight: bold;">\&quot;</span> &quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #ff0000;">'</span></pre></div></div>

<p>Use whatever works for you.</p>
<h2>Going one step further</h2>
<p>Maybe you want to adjust the code above to suit your needs but you&#8217;re way too lazy to do this. I thought about that too and setup the following JavaScript. Change the values as you see fit and copy the corresponding code to your form; maybe you want to set the name &#8211; <code>quiz-4711</code> &#8211; to something else.</p>
<form action="">
<table>
<tr>
<td style="width:12em;">Min number</td>
<td>
<input type="text" name="min" id="min" size="3" value="1" onkeyup="print_quiz(this.form)"/></td>
</tr>
<tr>
<td style="width:12em;">Max number</td>
<td>
<input type="text" name="max" id="max" size="3" value="9" onkeyup="print_quiz(this.form)"/></td>
</tr>
<tr>
<td style="width:12em;">Limit</td>
<td>
<input type="text" name="limit" id="limit" size="3" value="9" onkeyup="print_quiz(this.form)"/></td>
</tr>
<tr>
<td colspan="2"><textarea id="quiz" cols="60" rows="3">[quiz quiz-4711 class:quiz \"1+1=?|2\" \"1+2=?|3\" \"1+3=?|4\" \"1+4=?|5\" \"1+5=?|6\" \"1+6=?|7\" \"1+7=?|8\" \"1+8=?|9\" \"2+1=?|3\" \"2+2=?|4\" \"2+3=?|5\" \"2+4=?|6\" \"2+5=?|7\" \"2+6=?|8\" \"2+7=?|9\" \"3+1=?|4\" \"3+2=?|5\" \"3+3=?|6\" \"3+4=?|7\" \"3+5=?|8\" \"3+6=?|9\" \"4+1=?|5\" \"4+2=?|6\" \"4+3=?|7\" \"4+4=?|8\" \"4+5=?|9\" \"5+1=?|6\" \"5+2=?|7\" \"5+3=?|8\" \"5+4=?|9\" \"6+1=?|7\" \"6+2=?|8\" \"6+3=?|9\" \"7+1=?|8\" \"7+2=?|9\" \"8+1=?|9\"]</textarea></td>
</tr>
</table>
</form>
<p><script type="text/javascript">
//<![CDATA[
<!--
function print_quiz(form) {
  var min = form.min.value;
  var max = form.max.value;
  var limit = form.limit.value;
  form.quiz.value = "[quiz quiz-4711 class:quiz ";
  for (i = min; i < max; i++) {
    for (j = min; j < max; j++) {
      var sum = i*1 + j*1;
      if (sum > limit) continue;
      form.quiz.value += "\"" + i + "+" + j + "=?|" + sum + "\" ";
    }
  }
  form.quiz.value += "]";
}
//-->
//]]&gt;
</script></p>
<h2>Conclusion</h2>
<p>Using a quiz along with Contact Form 7 helped me to eliminate spam submitted through the forms I&#8217;ve set up. The quiz is super easy and shouldn&#8217;t annoy the user. Since I&#8217;ve used the scripts above numerous times I thought about sharing them with everybody who&#8217;d like to use the quiz this way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/generate-quiz-contact-form-7/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Removing the WordPress Generator meta tag completely</title>
		<link>http://www.christianschenk.org/blog/removing-wordpress-generator-meta-tag-completely/</link>
		<comments>http://www.christianschenk.org/blog/removing-wordpress-generator-meta-tag-completely/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 21:25:36 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/?p=358</guid>
		<description><![CDATA[Shows you how to remove the generator meta tag completely that's being added by WordPress' core after a fresh installation]]></description>
			<content:encoded><![CDATA[<p>WordPress adds a <em>generator</em> tag at various locations. Basically that&#8217;s a good idea because it provides a means to check out the different versions of WordPress that are actively being used in the blogosphere.</p>
<p><span id="more-358"></span></p>
<p>I&#8217;ve found the generator meta tag in my fresh installation of WordPress 2.7 here, there and everywhere:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* In the HTML header */</span>
<span style="color: #339933;">&lt;</span>meta name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;generator&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;WordPress 2.7&quot;</span> <span style="color: #339933;">/&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* In the RSS feed */</span>
<span style="color: #339933;">&lt;</span>generator<span style="color: #339933;">&gt;</span>http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//wordpress.org/?v=2.7&lt;/generator&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* In the Atom feed */</span>
<span style="color: #339933;">&lt;</span>generator uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://wordpress.org/&quot;</span>
 version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2.7&quot;</span><span style="color: #339933;">&gt;</span>WordPress<span style="color: #339933;">&lt;/</span>generator<span style="color: #339933;">&gt;</span></pre></div></div>

<p>And the <a href="http://trac.wordpress.org/browser/tags/2.7/wp-includes/general-template.php#L1872">code suggests</a> that there&#8217;re even more places where this tag might show up.</p>
<h2>How to remove it completely</h2>
<p>If you&#8217;re doing some <a href="http://codex.wordpress.org/Hardening_WordPress#Security_through_obscurity">security through obscurity</a> you might have <a href="http://www.google.com/search?q=remove+wordpress+meta+generator">googled</a> a little bit and found the solutions that use the following piece of PHP code just unsatisfactory:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">remove_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_generator'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So let&#8217;s remove it completely like so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> rm_generator_filter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_generator'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rm_generator_filter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will remove the tag everywhere: from the HTML, the RSS and the Atom feed, et cetera.</p>
<h3>WordPress&#8217; world of possibilities&#8230;</h3>
<p>Now I&#8217;d like to present another solution that might make sense: What about removing the generator tag almost everywhere <strong>but</strong> not in case of RDF content? Since RDF is widely used as a format for data mining applications why not show the information to these web robots? You could do this like so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> rm_generator_filter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'add_filter'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$types</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'html'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'xhtml'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'atom'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rss2'</span><span style="color: #339933;">,</span>
                 <span style="color: #666666; font-style: italic;">/*'rdf',*/</span> <span style="color: #0000ff;">'comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'export'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$types</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span>
    add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_the_generator_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rm_generator_filter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>What it does is adding a filter for every <code>type</code> but <em>RDF</em> returning just and empty string for the generator meta tag.</p>
<p>Although this doesn&#8217;t make much sense from the standpoint of security through obscurity because making the information available in just one place would compromise your <em>security</em> anyway, I just wanted to show that WordPress is flexible enough to do something like this.</p>
<h2>Download</h2>
<p>You can download the above code packaged in a plugin <a href="http://data.christianschenk.org/removing-wordpress-generator-meta-tag-completely/remove-generator-meta-tag.zip">here</a>. Have a look at the code and checkout the <code>define</code> in line 30: set it to true or false whether you&#8217;d like to remove the tag completely or not; the default is to remove it just everywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/removing-wordpress-generator-meta-tag-completely/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Integrate SmoothGallery into WordPress</title>
		<link>http://www.christianschenk.org/blog/integrate-smoothgallery-into-wordpress/</link>
		<comments>http://www.christianschenk.org/blog/integrate-smoothgallery-into-wordpress/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 21:45:33 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[smoothgallery]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/blog/integrate-smoothgallery-into-wordpress/</guid>
		<description><![CDATA[SmoothGallery doesn't play well with Prototype if you're using Internet Explorer so don't use them together]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been working on a <a href="/projects/wordpress-smoothgallery-plugin/">plugin</a> that integrates JonDesign&#8217;s <a href="http://smoothgallery.jondesign.net/">SmoothGallery</a> into WordPress. Basically this is pretty straightforward because all I had to do was to build some code around the JavaScript and CSS and put everything into a plugin.</p>
<p>Then I was <a href="/projects/wordpress-smoothgallery-plugin/comment-page-1/#comment-636">told</a> that the plugin as I built it wasn&#8217;t working with Internet Explorer. I booted up Windows and came up with a solution to this <em>problem</em> that I want to share here: don&#8217;t embed SmoothGallery and <a href="http://www.prototypejs.org/">Prototype</a> on the same page.</p>
<p><span id="more-68"></span></p>
<h2>SmoothGallery and Prototype</h2>
<p>Jonathan warns us on the <a href="http://smoothgallery.jondesign.net/download/">download page</a> that he doesn&#8217;t recommend the <code>namespaced</code> version of SmoothGallery because of incompatible frameworks like <a href="http://www.prototypejs.org/">Prototype</a> or <a href="http://jquery.com/">jQuery</a>.</p>
<p>I did some tests and found out that SmoothGallery doesn&#8217;t work with Prototype at all &#8211; if you&#8217;re using Internet Explorer. You can download the tests <a title="Tests using SmoothGallery and Prototype" href="http://data.christianschenk.org/integrate-smoothgallery-into-wordpress/sg-ie-test.zip">here</a>: Just open the HTML files and check whether the gallery is present.</p>
<p>Have a look at my results:</p>
<table class="cmpicons">
<thead>
<tr>
<th>SmoothGallery</th>
<th>Prototype</th>
<th>Internet Explorer</th>
<th>Firefox</th>
<th>Safari</th>
</tr>
</thead>
<tr>
<td>1.2</td>
<td class="present"><span>Present</span></td>
<td class="doesntwork"><span>Doesn&#8217;t work</span></td>
<td class="works"><span>Works</span></td>
<td class="works"><span>Works</span></td>
</tr>
<tr>
<td>1.2</td>
<td class="notpresent"><span>Not present</span></td>
<td class="works"><span>Works</span></td>
<td class="works"><span>Works</span></td>
<td class="works"><span>Works</span></td>
</tr>
<tr>
<td>2.0</td>
<td class="present"><span>Present</span></td>
<td class="doesntwork"><span>Doesn&#8217;t work</span></td>
<td class="works"><span>Works</span></td>
<td class="works"><span>Works</span></td>
</tr>
<tr>
<td>2.0</td>
<td class="notpresent"><span>Not present</span></td>
<td class="works"><span>Works</span></td>
<td class="works"><span>Works</span></td>
<td class="works"><span>Works</span></td>
</tr>
</table>
<p>If you try to use SmoothGallery with Prototype enabled in Internet Explorer the gallery won&#8217;t be rendered; I have tested this with version 6 and 7 of IE. No problems with Firefox or Safari though.</p>
<p>There&#8217;s another thing I noticed: if you change the order of the <code>script</code> entries in the HTML header IE will display the images of the gallery in two different ways. Either you&#8217;ll be able to see all pictures in the gallery or you&#8217;ll just see the first one.</p>
<p>Another observation is that SmoothGallery breaks apart if you insert an <code>a</code> tag with the <code>name</code> set to <em>options</em>. Once you&#8217;ve inserted such an anchor IE won&#8217;t render the gallery; again no problems with Firefox or Safari.</p>
<h2>Conclusion</h2>
<p>I&#8217;ve just explained what I observed testing JonDesign&#8217;s SmoothGallery and Prototype with Internet Explorer, Firefox and Safari. I didn&#8217;t take a look at the JavaScript and didn&#8217;t search for a solution there.</p>
<p>If you want IE users to watch a <em>smooth</em> gallery on your website it seems that there&#8217;s no other way than to get rid of Prototype &#8211; remove it at least from the specific page you&#8217;re using a SmoothGallery on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/integrate-smoothgallery-into-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Translation for Excerpt Editor</title>
		<link>http://www.christianschenk.org/blog/translation-for-excerpt-editor/</link>
		<comments>http://www.christianschenk.org/blog/translation-for-excerpt-editor/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 06:35:15 +0000</pubDate>
		<dc:creator>Christian Schenk</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[german]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[translation]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.christianschenk.org/blog/translation-for-excerpt-editor/</guid>
		<description><![CDATA[Here you can find some screenshots from the German translation of the WordPress plugin Excerpt Editor]]></description>
			<content:encoded><![CDATA[<p>I created a translation for the <a title="WordPress" href="http://wordpress.org/">WordPress</a> plugin <a title="WordPress Excerpt Editor" href="http://www.laptoptips.ca/projects/wordpress-excerpt-editor/">Excerpt Editor</a> which lets you edit the excerpts of all your posts and pages conveniently. If you&#8217;re using the German translation for WordPress this plugin will appear in German too.</p>
<p>The translation will be integrated in the next release of the plugin which you may download <a title="Download WordPress plugin Excerpt Editor" href="http://wordpress.org/extend/plugins/excerpt-editor/">here</a>.</p>
<p><span id="more-66"></span></p>
<h2>Screenshots</h2>
<p>If you&#8217;re interested have a look at the nice look of the German translation.</p>
<div id="myGallery">
<div class="imageElement">
<h3>Edit excerpts</h3>
<p>This is the main screen where you can edit the excerpts (<em>Kurzfassungen</em>).</p>
<p><a href="http://data.christianschenk.org/translation-for-excerpt-editor/ee_edit.jpg" title="open image" class="open"></a></p>
<p><img src="http://data.christianschenk.org/translation-for-excerpt-editor/ee_edit_thumb.jpg" class="full" alt="Edit excerpts" /></p>
</div>
<div class="imageElement">
<h3>Editor options</h3>
<p>This is the options pane for the editor.</p>
<p><a href="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_editor.jpg" title="open image" class="open"></a><br />
<img src="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_editor_thumb.jpg" class="full" alt="Editor options" /></p>
</div>
<div class="imageElement">
<h3>Auto-Generate options</h3>
<p>Here you can see the options for automatically generating excerpts.</p>
<p><a href="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_autogen.jpg" title="open image" class="open"></a><br />
<img src="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_autogen_thumb.jpg" class="full" alt="" /></p>
</div>
<div class="imageElement">
<h3>Append options</h3>
<p>Appending excerpts can be configured here.</p>
<p><a href="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_append.jpg" title="open image" class="open"></a><br />
<img src="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_append_thumb.jpg" class="full" alt="Append options" /></p>
</div>
<div class="imageElement">
<h3>Replace options</h3>
<p>Options for replacing posts with excerpts.</p>
<p><a href="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_replace.jpg" title="open image" class="open"></a><br />
<img src="http://data.christianschenk.org/translation-for-excerpt-editor/ee_options_replace_thumb.jpg" class="full" alt="Replace options" /></p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.christianschenk.org/blog/translation-for-excerpt-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
