<?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>Fireside Media Development Blog &#187; HOWTO</title>
	<atom:link href="http://www.firesidemedia.net/dev/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.firesidemedia.net/dev</link>
	<description></description>
	<lastBuildDate>Mon, 24 Aug 2009 23:23:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Show Only Children Pages on Parent Page</title>
		<link>http://www.firesidemedia.net/dev/show-only-children-pages-on-parent-page/</link>
		<comments>http://www.firesidemedia.net/dev/show-only-children-pages-on-parent-page/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 22:54:32 +0000</pubDate>
		<dc:creator>Jonathan Dingman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.firesidemedia.net/dev/?p=113</guid>
		<description><![CDATA[There is still much to be desired within WordPress when it comes to dealing with parent and children pages. The core code is there, and it&#8217;s usable, but there&#8217;s not a lot &#8220;out of the box&#8221; to play with. We&#8217;ve developed a bit of code to help make your life a little easier. Adding the [...]]]></description>
			<content:encoded><![CDATA[<p>There is still much to be desired within WordPress when it comes to dealing with parent and children pages.  The core code is there, and it&#8217;s usable, but there&#8217;s not a lot &#8220;out of the box&#8221; to play with.</p>
<p><strong>We&#8217;ve developed a bit of code to help make your life a little easier.</strong></p>
<p>Adding the code below to your functions.php file will let you remove the other children pages while on the parent page.</p>
<pre class="brush: php;">add_filter('wp_list_pages_excludes', 'remove_others_children');
function remove_others_children($excludes = array()) {
  $all_pages = get_pages();
  $all_children = (array) get_page_children(true, $all_pages);
  foreach ( $all_children as $child )
    $excludes[] = $child-&gt;ID;

  if ( ! is_page() )
    return $excludes;

  global $post;

  $this_heirarchy = (array) $post-&gt;ancestors;
  $this_children = (array) get_page_children($post-&gt;ID, $all_pages);
  foreach ( $this_heirarchy as $ancestor )
    $this_children = array_merge($this_children, (array) get_page_children($ancestor, $all_pages));

  foreach ($this_children as $child)
    $this_heirarchy[] = $child-&gt;ID;

  return array_diff($excludes, $this_heirarchy);
}</pre>
<p>Here are some examples of what it would like without the code, then with the code.</p>
<p><img src="http://www.firesidemedia.net/dev/files/wordpress-remove-children-from-parents-pages.jpg" alt="WordPress:  Remove Children Pages from Parent Pages" title="WordPress:  Remove Children Pages from Parent Pages" width="491" height="474" class="size-full wp-image-115" /></p>
<p>A huge thanks goes out to <a href="http://sivel.net/">Matt Martz</a> for working with us on helping get this code ready.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.firesidemedia.net/dev/show-only-children-pages-on-parent-page/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>OpenX Advanced Targeting Using WordPress</title>
		<link>http://www.firesidemedia.net/dev/openx-targeting-using-wordpress/</link>
		<comments>http://www.firesidemedia.net/dev/openx-targeting-using-wordpress/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 13:23:46 +0000</pubDate>
		<dc:creator>Jonathan Dingman</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[OpenX]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.firesidemedia.net/dev/?p=56</guid>
		<description><![CDATA[What is Openx OpenX is, in my opinion, the most efficient and hands-free open source ad server on the web today. It&#8217;s flexible, easy to use, and best of all, free. What is WordPress WordPress is one of the leading platforms in blogging on the web today. Whether you are self-hosted (using wordpress.org) or being [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is Openx</strong></p>
<p>OpenX is, in my opinion, the most efficient and hands-free open source ad server  on the web today.  It&#8217;s flexible, easy to use, and best of all, free.</p>
<p><strong>What is WordPress</strong></p>
<p>WordPress is one of the leading platforms in blogging on the web today.  Whether you are self-hosted (using wordpress.org) or being hosted on Automattic servers (using wordpress.com), WordPress is an amazing blogging platform which makes blogging easy and fun.</p>
<p>This OpenX and WordPress tutorial will outline how to more effectively use the targeting features of OpenX utilizing the built-in features of WordPress.  It will explain how to do this by using WordPress tags and OpenX source parameters, both built-in features to WordPress and OpenX, respectively.</p>
<p><strong>OpenX Solution Used</strong>:  Hosted OpenX (<a href="http://hosted.openx.org/">http://hosted.openx.org/</a>)<br />
<strong>WordPress Version</strong>: <a href="http://wordpress.org/download/release-archive/">2.6.2</a></p>
<p>For this tutorial, I will be using tags are the &#8220;source&#8221; for OpenX.</p>
<hr />
<h4>Step 1:  Setup tags so OpenX can view them as a &#8220;source.&#8221;</h4>
<pre class="php">&lt;?php
        while ( have_posts() ) : the_post();
                $fsm_oxtags = get_the_tags();
                if ($fsm_oxtags) { foreach ($fsm_oxtags as $tag) {
                        $taglist .= $tag-&gt;name . '|';
                }
                $taglist = rtrim($taglist, '|');
                $oxtags = rawurlencode($taglist);
                }
        endwhile;
?&gt;</pre>
<p>I have these in the top of my single.php file within WordPress.  This only creates the variable of $oxtags so it can be echo&#8217;d elsewhere.</p>
<p>Details of Step 1: The first bit of code will create the loop.  then it will go through each tag and set it as &#8220;tag |&#8221; because I am using pipes to separate each tag for OpenX.  Next, it will trim off the last pipe because it&#8217;s not needed, creating something like&#8230; &#8220;tag 1|tag 2|tag 3|tag 4&#8243; &#8230; and like I just mentioned, it will strip off the last pipe.  Lastly, it will put that string, &#8220;tag 1|tag 2|tag 3|tag 4&#8243; &#8230; into a raw encoded URL string which we will be able to echo later in the page.  <strong>Note:</strong> this is only being set at $oxtags so it can be used elsewhere, nothing is echo&#8217;d in this part of the script.<br />
<span id="more-56"></span></p>
<h4>Step 2: Setup your OpenX invocation code</h4>
<pre class="javascript">&lt;script type='text/javascript'&gt;&lt;!--//&lt;![CDATA[
   var m3_u = (location.protocol=='https:'?'https://d.openx.org/ajs.php':'http://d.openx.org/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write (&quot;&lt;scr&quot;+&quot;ipt type='text/javascript' src='&quot;+m3_u);
   document.write (&quot;?zoneid=1009&quot;);
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write (&quot;&amp;exclude=&quot; + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write (&quot;&amp;loc=&quot; + escape(window.location));
   document.write (&quot;&amp;source=<strong>&lt;?php echo $oxtags; ?&gt;</strong>&quot;);
   if (document.referrer) document.write (&quot;&amp;referer=&quot; + escape(document.referrer));
   if (document.context) document.write (&quot;&#038;context=&quot; + escape(document.context));
   if (document.mmm_fo) document.write (&quot;&amp;mmm_fo=1&quot;);
   document.write (&quot;'&gt;&lt;\/scr&quot;+&quot;ipt&gt;&quot;);
//]]&gt;--&gt;&lt;/script&gt;</pre>
<p>Now that we have the $oxtags variable ready, we can echo it where we need it.  Simply add the next line, such as I have, <code class="inline">document.write (&quot;&amp;source=<strong>&lt;?php echo $oxtags; ?&gt;</strong>&quot;);</code>, then we&#8217;re almost ready to start using advanced targeting within OpenX using your WordPress tags.</p>
<h4>Step 3:  Rewind the content loop</h4>
<p><span class="big red">!!! IMPORTANT !!!</strong></p>
<p>This is critical!  You must do this if you want your posts&#8217; content to display properly.</p>
<pre class="php">&lt;?php rewind_posts(); if (have_posts()) : while (have_posts()) : the_post(); ?&gt;</pre>
<p>The reason for this is that you need to rewind the posts so the loop is displayed properly. (<a href="http://codex.wordpress.org/The_Loop#Loop_Examples_2">documentation</a>)</p>
<p>The line above is what my real loop looks like in my single.php file, ensuring that the content of the loop is displayed properly as it was originally.</p>
<p><strong>Note:</strong> You only need to rewind_posts(); if you have multiple loops or you put the Step 1 code before the first loop, which I did for this tutorial.</p>
<h4>Step 4:  Setup OpenX Targetting to Deliver to Specific Tags</h4>
<p>Now that we have sources setup within the JavaScript and PHP for WordPress, we need to get to work adding some banners using specific sources.  Go to one of your campaigns, then select a banner you&#8217;ve already added or add a new banner.  Go to the <strong>Delivery Options</strong> tab.  This is where you can select your targeting limitations.</p>
<p>First, add the delivery option to limit the banner display for a specific source.</p>
<p><img src="http://www.firesidemedia.net/dev/files/wordpress-openx-target-source.jpg" alt="OpenX: Setup Delivery Options to be Limited by a Source" title="OpenX: Setup Delivery Options to be Limited by a Source" /></p>
<p>Next, set it to &#8220;contains&#8221; so you can specify which tagged posts you want to display this banner.</p>
<p><img src="http://www.firesidemedia.net/dev/files/wordpress-openx-target-contains.jpg" alt="OpenX: Setup Delivery Options to Contain a Source" title="OpenX: Setup Delivery Options to Contain a Source" /></p>
<p>Lastly, specify the source you want to use fr banner delivery limitation.</p>
<p><img src="http://www.firesidemedia.net/dev/files/wordpress-openx-banner-delivery-options.jpg" alt="OpenX: Specify the Delivery Source for Banner Limitation" title="OpenX: Specify the Delivery Source for Banner Limitation" /></p>
<h4>Results</h4>
<p>Here is what your final output should look like:</p>
<pre class="javascript">&lt;script type='text/javascript'&gt;&lt;!--//&lt;![CDATA[
   var m3_u = (location.protocol=='https:'?'https://d.openx.org/ajs.php':'http://d.openx.org/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write (&quot;&lt;scr&quot;+&quot;ipt type='text/javascript' src='&quot;+m3_u);
   document.write (&quot;?zoneid=1009&quot;);
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write (&quot;&amp;exclude=&quot; + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write (&quot;&amp;loc=&quot; + escape(window.location));
   document.write (&quot;&amp;source=<strong>tag%201%7Ctag%202</strong>&quot;);
   if (document.referrer) document.write (&quot;&amp;referer=&quot; + escape(document.referrer));
   if (document.context) document.write (&quot;&#038;context=&quot; + escape(document.context));
   if (document.mmm_fo) document.write (&quot;&amp;mmm_fo=1&quot;);
   document.write (&quot;'&gt;&lt;\/scr&quot;+&quot;ipt&gt;&quot;);
//]]&gt;--&gt;&lt;/script&gt;</pre>
<p>I bolded the part that was used with the Step 1 code.  Basically, it will output your tags for each WordPress post as a &#8220;source&#8221; so you can use them for targeting on your site.</p>
<p><em>Thanks goes out to <a href="http://outnow.ch/">Thomas</a> and <a href="http://www.stevesmith1983.co.uk/">Steve Smith</a> for helping me get this working</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.firesidemedia.net/dev/openx-targeting-using-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
