<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>CogDogBlog &#187; wordpress dissected</title>
	<atom:link href="http://cogdogblog.com/tag/wordpress-dissected/feed/" rel="self" type="application/rss+xml" />
	<link>http://cogdogblog.com</link>
	<description>Alan Levine&#039;s space for barking about and playing with technology</description>
	<lastBuildDate>Mon, 13 Feb 2012 03:36:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
		<item>
		<title>WordPress Dissected: The Blogless Blog</title>
		<link>http://cogdogblog.com/2009/07/23/blogless-blog/</link>
		<comments>http://cogdogblog.com/2009/07/23/blogless-blog/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 06:30:12 +0000</pubDate>
		<dc:creator>Alan Levine</dc:creator>
				<category><![CDATA[Blog Pile]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[wordpress dissected]]></category>

		<guid isPermaLink="false">http://cogdogblog.com/?p=3939</guid>
		<description><![CDATA[It&#8217;s been a while but it is time to add to my collection of WordPress Dissected where I break down web sites I have been building using WordPress but with some moderate to severe template wrangling. Today I present an NMC project set that is sort of a Zen Riddle. If a blog has no posts is it a web site? This is the editing area for a finished web site: How? Why? The web site is made up entirely of WordPress pages, because there is nothing chronological in the site&#8217;s structure (though if we ever added a news section it would be easy). There was a reason I organized it around Pages&#8230; and I cannot remember why, but had something to do with being able to list the pages in a sidebar. I think. To be honest, the work started more than a year ago and the site sat [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while but it is time to add to my collection of <a href="http://cogdogblog.com/tag/wordpress-dissected/">WordPress Dissected</a> where I break down web sites I have been building using WordPress but with some moderate to severe template wrangling.</p>
<p>Today I present an NMC project set that is sort of a Zen Riddle. If a blog has no posts is it a web site? This is the editing area for a finished web site:</p>
<p><a href="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-no-posts.jpg"><img src="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-no-posts-500x273.jpg" alt="marcus-no-posts" title="marcus-no-posts" width="500" height="273" class="alignnone size-medium wp-image-3947" /></a></p>
<p>How? Why?</p>
<p>The web site is made up entirely of WordPress pages, because there is nothing chronological in the site&#8217;s structure (though if we ever added a news section it would be easy). There <strong>was</strong> a reason I organized it around Pages&#8230; and I cannot remember why, but had something to do with being able to list the pages in a sidebar. I think. To be honest, the work started more than a year ago and the site sat behind a password until the grant funders for the project  where ready to go public.</p>
<p>The site is for the <a href="http://marcus.nmc.org/">Edward and Betty Marcus Digital Education Project for Texas Art Museums</a>, a project where we worked with 28 art museum or art education programs in Texas to help them apply storytelling concepts to their collections and artists, and use the <a href="http://pachyderm.nmc.org/">Pachyderm software </a> to create online exhibits.</p>
<p><a href="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-site.jpg"><img src="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-site-500x358.jpg" alt="marcus-site" title="marcus-site" width="500" height="358" class="alignnone size-medium wp-image-3948" /></a><br />
<span id="more-3939"></span><br />
<a href="http://va4business.com/talian/"><img src="http://cogdogblog.com/wp-content/uploads/2009/07/screenshot.gif" alt="screenshot" title="screenshot" width="300" height="200" class="alignright size-full wp-image-3951" /></a> The overall template design has morphed quite a bit. I knew form the beginning it was going to need a basic 3 column layout, and somehow ended up with <a href="http://va4business.com/talian/">Talian</a> which actually does not now look like the first version I had&#8230; and beyond the cosmetic changes I ended up doing a lot of cleanup and fixes for the CSS. </p>
<p>There was an intermediate version (now lost) that had a pink and green theme, even an animated Flash Texas map&#8211;  a mock layout is what  found and the now unused map that wa supposed to be a splash intro:</p>
<p><img src="http://cogdogblog.com/wp-content/uploads/2009/07/layout-test-2-500x214.jpg" alt="layout test 2" title="layout test 2" width="500" height="214" class="alignnone size-medium wp-image-3952" /></p>
<p><a href="http://cogdogblog.com/wp-content/uploads/2009/07/texas.jpg"><img src="http://cogdogblog.com/wp-content/uploads/2009/07/texas-500x297.jpg" alt="texas" title="texas" width="500" height="297" class="alignnone size-medium wp-image-3954" /></a></p>
<p>Soon before we went public, we got a hint that they wanted something less cartoonish and simpler, so we went to the more Texas color theme of the final site.</p>
<p>That&#8217;s just the cosmetics. Time to go under the hood and bang the pipes. </p>
<p>The bulk of the site are different WordPress Pages for each museum, such as the <a href="http://marcus.nmc.org/blanton-museum-of-art/">Blanton Museum of Art</a>:</p>
<p><a href="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-blanton.jpg"><img src="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-blanton-500x330.jpg" alt="marcus-blanton" title="marcus-blanton" width="500" height="330" class="alignnone size-medium wp-image-3944" /></a></p>
<p>The left sidebar on all site pages is the same- some static top links, and using the command to list all the museum pages by excluding all the other pages</p>
<pre class="brush: php">
&lt;h3&gt;Museums&lt;/h3&gt;
&lt;ul&gt;

&lt;?php
  wp_list_pages(
  &#039;title_li=&amp;sort_column=post_title
  &amp;exclude=2,3,4,33,34,86&#039;;
)?&gt;
&lt;/ul&gt;
</pre>
<p>The main column content is written for each museum, with some standard headings. The project screen shots are linked to the museum&#8217;s Pachyderm Projects- which show a lot of evolution in the two years of the projects, as the <a href="http://web.nmc.org/pachy/Matto8/">Matto example from the Blanton</a> demonstrates nicely.</p>
<p>At the bottom, in homage to the lost map, I have embedded Google MyMaps with locations for each museum, so if you are on <a href="http://marcus.nmc.org/old-jail-art-center/">the page for the Old Jail Art Center</a>, there is a &#8220;Where in Texas is the Old Jail Art Center&#8221;</p>
<p><a href="http://maps.google.com/maps?q=The+old+jail+art+center,+762-2269,+201+South+2nd+St&#038;sll=32.724060,-99.295754&#038;sspn=0.015533,0.029188&#038;ie=UTF8&#038;t=p&#038;cid=32723443,-99301879,14060530885401652689&#038;ll=38.134557,-97.163086&#038;spn=12.089317,18.676758&#038;z=5&#038;iwloc=A&#038;source=embed"><img src="http://cogdogblog.com/wp-content/uploads/2009/07/marcus-map-old-jail-493x400.jpg" alt="marcus-map-old-jail" title="marcus-map-old-jail" width="493" height="400" class="alignnone size-medium wp-image-3945" /></a></p>
<p>and the main web page has <a href="http://maps.google.com/maps/ms?hl=en&#038;ie=UTF8&#038;t=p&#038;msa=0&#038;msid=113342795738536960498.000469f6f403d49be4883&#038;ll=31.877558,-99.492187&#038;spn=13.043722,18.676758&#038;z=5&#038;source=embed">a full map with all the museums located</a>.</p>
<p>All the magic happens on the right sidebar. All of the Museum pages use a special page-museum.php template which just simply has it use a pecial sidebar template rather than the one used on the front page.</p>
<p>I am using some custom queries, external include files, and plugins to pull in museum specific content on the right sidebar. A lazy way would have been to use a separate template for each museum, but I was able to do it from a single sidebar template, using as a reference the database ID for the page.</p>
<p>The first section, <strong>Explore Projects</strong>,  presents an abstract of all the museum&#8217;s projects, which can be anywhere from one to four like the <a href="http://marcus.nmc.org/arthouse-at-the-jones-center/">Art House at Jones Center</a>. The content in the box is pulled from an external content file in the template/projects subdirectory. The files are named based on the database ID for the page, like <code>3.php</code>, <code>22.php</code> etc. This makes it generic for the template to pull in the correct content.</p>
<p>We first jimmy through another iteration of the Loop to grab the ID of the current page</p>
<pre class="brush: php">
  &lt;?php if (have_posts()) : ?&gt;
    &lt;?php while (have_posts()) : the_post(); ?&gt;
    	&lt;?php $mypost = $post-&gt;ID; ?&gt;
    &lt;?php endwhile; ?&gt;
  &lt;?php endif; ?&gt;
</pre>
<p>On a single Page, there is only one &#8220;post&#8221; and from that we get the ID. Then we simply call an include PHP statement to insert the content of that file:</p>
<pre class="brush: php">
&lt;?php
$mfile = TEMPLATEPATH . &#039;/projects/&#039; . $mypost . &#039;.php&#039;;
if (file_exists($mfile)) require_once($mfile);
?&gt;
</pre>
<p>I created these content files as structured PHP statements, so our staff person creating content only had to define content for variables:</p>
<p>There is first some variables that provide the info for the museum:</p>
<pre class="brush: php">
&lt;?php
// modify for each museum name
$mymuseumname = &#039;Austin Museum of Art&#039;;

// the page URL used on this site
$mypage = &#039;austin-museum-of-art&#039;;
?&gt;
</pre>
<p>The next part handles two ways this content is used- if called from a projects-page template we display the name of the museum as a header. But, as we show below, this same content can be called for the front page as a random museum highlighted, so we need to be able to echo different text if the current page template indicates it is a general page:</p>
<pre class="brush: php">
// logic to add explanatory text for pages other than museums
if (is_page_template(&#039;page.php&#039;)) {
	echo &#039;&lt;p&gt;Explore these projects from
        &lt;a href=&quot;/&#039; . $mypage . &#039;&quot;&gt;&#039; .
         $mymuseumname . &#039;&lt;/a&gt;&lt;/p&gt;&#039;;
} elseif (is_page_template(&#039;page-projects.php&#039;)) {
	echo &#039;&lt;h3&gt;&lt;a href=&quot;/&#039; . $mypage . &#039;&quot;&gt;&#039;
            . $mymuseumname . &#039;&lt;/a&gt;&lt;/h3&gt;&#039;;
}
</pre>
<p>Finaly, we create a block like this for each project to be listed for a museum, so if there are 4 projects for the page associated with page ID 14, then file 14.php would need four copies of this block of code. The image file is for the square icon stored in the template directory</p>
<pre class="brush: php">
&lt;?php
// ----- BEGIN EDIT FOR EACH PROJECT ---------

// modify for the linkname for the picture
$mytitle = &#039;New Art in Austin: 20 to Watch&#039;;
$myimage = &#039;AMOA_85.jpg&#039;;
$mylink = &quot;http://amoainteractive.org/newartinaustin2008/&quot;;
$myblurb = &#039;New Art in Austin features emerging artists
    from central Texas whose work stretches the boundaries
    of contemporary art.&#039;;

// --- do not edit below the line! ------------
?&gt;

&lt;p&gt;&lt;strong&gt;&lt;?php echo $mytitle?&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;a href=&quot;&lt;?php echo $mylink?&gt;&quot;&gt;
&lt;img src=&quot;&lt;?php bloginfo(&#039;template_directory&#039;); ?&gt;
   /images/projects-sm/&lt;?php echo $myimage?&gt;&quot;
   class=&quot;alignleft&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;?php echo $myblurb?&gt;
(&lt;a href=&quot;&lt;?php echo $mylink?&gt;&quot;&gt;explore...&lt;/a&gt;)
&lt;br clear=&quot;left&quot;&gt;&lt;/p&gt;

&lt;?php
// ----- END EDIT FOR EACH PROJECT ---------
?&gt;
</pre>
<p>The next section lists recent comments that have been made only for a particiular museum&#8211; to get this to work, I use a function that was built into this template (I think it was, or I put it in there) that allows me to pull an abstact of a comment made specific to a page. I&#8217;m able to specify character limits for te comments title, author, format the date string, and most importantly, provide a post ID to limit it to pull comments just to this one page.</p>
<pre class="brush: php">
&lt;h3&gt;Recent Comments&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Read what viewers have to say
  about these projects...&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;?php
  mw_recent_comments(8, false, 35, 15, 35, &#039;all&#039;,
   &#039;&lt;li&gt;&lt;a href=&quot;%permalink%&quot; title=&quot;%title%&quot;&gt;
    &lt;strong&gt;%author_name%&lt;/strong&gt; said
   &lt;em&gt;&quot;%excerpt%&quot;&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&#039;,&#039;d.m.y, H:i&#039;,
    &#039;&lt;li&gt;No one has commented on these projects yet!
   &lt;a href=&quot;#comment-temps&quot;&gt;add one now&lt;/a&gt;&lt;/li&gt;&#039;,
     &#039;Pingback&#039;, &#039;Trackback&#039;, &#039;on&#039;, $post-&gt;ID, 150 ); ?&gt;
&lt;/ul&gt;
</pre>
<p>That&#8217;s all there is (hah) to a museum page. </p>
<p>I also created a <a href="http://marcus.nmc.org/projects/">single page that lists all projects in one display<br />
</a>, and this does so by simply inserting all of the include files described above used for the side bar. This page uses a special page-projects,php template, which instead of using the content entered for the page in the editor, just pulls it from the external files:</p>
<p>First we simply walk the directory that contains all of the page sidebar content files to build a list of all files, and then sort the file names:</p>
<pre class="brush: php">
if ($handle = opendir(TEMPLATEPATH . &#039;/projects&#039;)) {
  // get all file names in directory
  while (false !== ($file = readdir($handle))) {
    if ($file !=&#039;.&#039; and $file != &#039;..&#039;) $myfiles[] = $file;
  }
  closedir($handle);
sort($myfiles, SORT_NUMERIC);
</pre>
<p>Now that we have all the file names in an array, we simply walk the array and include the files as indicated.</p>
<pre class="brush: php">
foreach ($myfiles as $item) {
  // display content in file
  echo &#039;&lt;div class=&quot;list-box&quot;&gt;&lt;div class=&quot;listing&quot;&gt;&#039;;
  require_once(TEMPLATEPATH . &#039;/projects/&#039; . $item);
  echo &#039;&lt;/div&gt;&lt;/div&gt;&#039;;
  }
}
?&gt;
</pre>
<p>And that&#8217;s it-  a blog with no blog posts (does it make a sound?)</p>
<p>The next thing I am adding is a gallery page that will have icons for all projects that we can present as a way to explore all the projects in one page, maybe with some CoolIris action.</p>
]]></content:encoded>
			<wfw:commentRss>http://cogdogblog.com/2009/07/23/blogless-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>WordPress Theme Hacking (fun): Ninmah&#8217;s Postcards</title>
		<link>http://cogdogblog.com/2009/04/29/postcards/</link>
		<comments>http://cogdogblog.com/2009/04/29/postcards/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 17:06:56 +0000</pubDate>
		<dc:creator>Alan Levine</dc:creator>
				<category><![CDATA[Blog Pile]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress dissected]]></category>

		<guid isPermaLink="false">http://cogdogblog.com/?p=3575</guid>
		<description><![CDATA[My colleague Rachel Smith presented a nice little WordPress challenge to re-create what she had done previously as old skool manual HTML page updating into her WordPress blog (see Postcards back through time). In the spirit of previous documentation of WordPress Theme hacking, here is the under the hood things I did, some variations on ones I have written previously WordPressing Dissected: Pachyderm Services and Making of a New Site: NMC Virtual Worlds. This current write up includes a custom category template, direct database querying, custom fields, and maybe a little elbow grease. Firstly, the original site of Rachel&#8217;s postcards features her original artwork, with the most recent one at the top, and icon links to previous works below. I would guess creating a new one is making a new HTML page, copying some source code to the top of the index, and updating the icons below. Maybe it&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p>My colleague Rachel Smith presented a nice little WordPress challenge to re-create what she had done previously as old skool manual HTML page updating into her WordPress blog (see <a href="http://ninmah.be/2009/04/28/postcards-back-through-time/">Postcards back through time</a>). In the spirit of previous documentation of WordPress Theme hacking, here is the under the hood things I did, some variations on ones I have written previously <a href="http://cogdogblog.com/2008/02/14/wordpressing-dissected/">WordPressing Dissected: Pachyderm Services</a>  and <a href="http://cogdogblog.com/2007/01/16/making/">Making of a New Site: NMC Virtual Worlds</a>.</p>
<p>This current write up includes a custom category template, direct database querying, custom fields, and maybe a little elbow grease.</p>
<p>Firstly, <a href="http://indigogecko.com/postcards/">the original site of Rachel&#8217;s postcards</a> features her original artwork, with the most recent one at the top, and icon links to previous works below. I would guess creating a new one is making a new HTML page, copying some source code to the top of the index, and updating the icons below.</p>
<p><a href="http://indigogecko.com/postcards/"><img src="http://cogdogblog.com/wp-content/uploads/2009/04/postcards.png" alt="postcards" title="postcards" width="500" height="442" class="alignnone size-full wp-image-3578" /></a></p>
<p>Maybe it&#8217;s not all that onerous, but it is all manual writing of HTML, etc, and to me, really screamed for re-doing the WordPress Way, meaning that authoring is done via the simple WP interface, and pages and archives are automatically created. Plus you get comments (well if someone leaves some); Plus it is integrated into <a href="http://ninmah.be/">her current blog</a>, not a hanging appendage.</p>
<p>Even in what she did before by hand is pretty much what one might define as blogging, and <a href="http://ninmah.be/category/postcards/">the resulting new site</a> really sets up nicely.</p>
<p>The way it works now is that every new postcard is created as <a href="http://ninmah.be/2009/02/25/postcard-time-tears-and-fire/">a regular blog post</a>, marked by a special category. A custom category template, detailed below, generates <a href="http://ninmah.be/category/postcards/">the archive or main entry view</a>. Database queries are thne used to generate a random set of 6 to go on the sidebar of her main template, and a special sidebar for the category page.</p>
<p><a href="http://ninmah.be/category/postcards/"><img src="http://cogdogblog.com/wp-content/uploads/2009/04/postcards-new.png" alt="postcards-new" title="postcards-new" width="500" height="678" class="alignnone size-full wp-image-3577" /></a></p>
<p>Here&#8217;s the juice on the code&#8230;.</p>
<h2>Custom Category Template</h2>
<p>When you assign a WordPress post to a category, your regular stock template is designed to generate a category view, which is usually just a copy o the normal reverse chronological posting of your blog main page, just with filtering out just the posts in the category. But with very little expertise needed, you can modify the appearance (or functionality) of a category archive by creating <a href="http://codex.wordpress.org/Category_Templates">a Category Template</a> specific for that category. This can be done by copying the guts of the main <code>index.php</code> or an <code>archive.php</code> template, and rename it <code>category-XX.php</code> where XX is the ID number for that category (you can find it be going to the control panel where you edit the post categories, and hover over the edit link- the URL reveals an id=XX in it as a unique identifier.</p>
<p>This means when WordPress is asked ti generate a category archive for Category XX it first sees if there is a specific one, and if not it uses <code>archive.php</code> or <code>index.php</code>. So her &#8220;postcards&#8221; category is id 129, so her template now includes a <code>category-129.php</code> template.</p>
<p>In there I has able to add the intro block of text that appears at the top. The trick on this one was making it so it would pull only the single most recent blog post in this category.</p>
<p>The core of understanding WordPress is getting into the Zen of <a href="http://codex.wordpress.org/The_Loop">The Loop</a>. In essence (at least my wording of it), when you are accessing different parts of WP content (the main page, an RSS feed, a category page, a tag page, etc), WP knows and automatically does a database query to get the appropriate posts, and then the templates &#8220;do something&#8221; with them, by cycling through The Loop (so your control panel has a place to tell it how many times to loop- if you want 3 recent posts on the front page or 50). This typically looks like in a template:</p>
<p><pre><pre>&lt;?php if(have_posts()) : ?&gt;
&nbsp;&nbsp;&lt;?php while(have_posts()) : the_post(); ?&gt;
&nbsp;&nbsp;
&nbsp;&nbsp;.. do stuff
&nbsp;&nbsp;&lt;?php endwhile; ?&gt;
&lt;?php endif?&gt;</pre></pre></p>
<p>It already has done the correct database query without the template having to ask for it.</p>
<p>So to become a WordPress Jedi Master (maybe) one key is learning how to make your Own Loops. The gateway is the <a href="http://codex.wordpress.org/Template_Tags/query_posts">query_posts command</a> which lets you steer The Loop. So for the category template, I want to make sure I grab posts just from the category I want and specify only 1 post (which by default is the most recent; so it means just inserting this above the code show above:</p>
<p><pre><pre>
&lt;?php query_posts(&#039;cat=129&amp;posts_per_page=1&#039;);?&gt;
</pre></pre></p>
<p>On the first iteration I put all the icons to previous posts below the current post card (like the original site), but then we decided to replace the regular sidebar content with this (see below). The way sidebars are customized var with the template design; with this one, it was just easier to replace the standard:</p>
<p><pre>&lt;?php get_sidebar(); ?&gt;</pre></p>
<p>with my own include statement:</p>
<p><pre><pre>
&lt;?php include (TEMPLATEPATH . &quot;/sidebar-postcards.php&quot;); ?&gt;
</pre></pre></p>
<h2>All Postcards on the Sidebar</h2>
<p>The sidebar on the <a href="http://ninmah.be/category/postcards/">Postcards</a> page is designed to place icons and links to all previous postcards, in reverse chronological order. To associate an icon for each post, we used <a href="http://codex.wordpress.org/Using_Custom_Fields">custom fields</a>. Rachel already had a directory of these images, so we just uploaded a directory named <strong>squares</strong> to her <code>wp-content</code> directory.</p>
<p>Since she had named the files systematically (2 digit month + 2 digit year) the easiest thing to do would have been to parse the post publish date to automatically retrieve the correct icon (we back dated the older post cards). The only problem was some of her icons were named *.gif and some were *.jpg, and while we could have converted them all to one format, I suggested using aq custom field named <strong>square</strong> to hold the name of the icon file for that post (this also allows them to be named anything and to have more than one per month).</p>
<p>The sidebar code also uses the same wp_query command as the category template- so you can have More Than One The Loop. I also use the <a href="http://www.coffee2code.com/wp-plugins/">Get Custom Field Values plugin</a> to retrieve the info we need.  The lop query this time calls for posts from this category, and using the value of -1 for <code>showposts</code> to return all posts in the category:</p>
<p><pre>WP_Query(&#039;category_name=postcards&amp;showposts=-1&#039;)</pre></p>
<p>For this one, all we need is the name of the custom field value (name of the icon file name) and link it to the post, so the code for <code>postcards-sidebar.php</code> (new file added to template directory) looks like:</p>
<p><pre><pre>&lt;h2 class=&quot;widgettitle&quot;&gt;
&nbsp;&nbsp;&lt;?php _e(&#039;All Postcards&#039;); ?&gt;&lt;/h2&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;?php 
$my_query = new WP_Query(&#039;category_name=postcards&amp;showposts=-1&#039;);?&gt;

&lt;?php while ($my_query-&gt;have_posts()) : 
&nbsp;&nbsp;&nbsp;&nbsp;$my_query-&gt;the_post();?&gt;

&lt;?php $postcard_icon = c2c_get_custom(&#039;square&#039;);?&gt;
&nbsp;&nbsp;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;
&nbsp;&nbsp;&lt;img src=&quot;/wp-content/squares/&lt;?php echo $postcard_icon ?&gt;&quot; 
&nbsp;&nbsp;border=&quot;0&quot; alt=&quot;&quot; style=&quot;margin:8px&quot; /&gt;&lt;/a&gt;
&lt;?php endwhile; ?&gt;
&lt;/div&gt;
</pre></pre></p>
<h2>Random Postcards for the Main Sidebars</h2>
<p><img src="http://cogdogblog.com/wp-content/uploads/2009/04/sidebar.jpg" alt="sidebar" title="sidebar" width="263" height="328" class="alignright size-full wp-image-3576" /><br />
I figured while I was tossing loops, I could make one that pulled X number of postcard icon/links at random for the main sidebar. </p>
<p>Unfortunately, as an experiment showed, while the <a href="http://codex.wordpress.org/Template_Tags/query_posts">query_posts command</a> has an option for <code>order=</code> the only options are ASC or DESC (these are just part of the MySQL query; trying a value of <code>order=RAND()</code> which works in mySQL queries did not work here.</p>
<p>So this called for a more low level loop creation, of <a href="http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query">calling the MySQL database directly</a>.  This involved a bit of playing with the syntax in phpMyAdmin, and sorting out finding the right structure to get the category (the relict category column in table wp_posts is not used; it is buried in the taxonomy and term relationship tables. The winning query to pull 6 random posts from category 139 was:<br clear="right"></p>
<p><pre><pre>
SELECT wposts.* FROM wp_posts wposts 
&nbsp;&nbsp; LEFT JOIN&nbsp;&nbsp;wp_term_relationships rel 
&nbsp;&nbsp;&nbsp;&nbsp; ON wposts.ID=rel.object_id&nbsp;&nbsp; 
&nbsp;&nbsp; WHERE rel.term_taxonomy_id = 139 
&nbsp;&nbsp;&nbsp;&nbsp; AND wposts.post_type = &#039;post&#039; 
&nbsp;&nbsp;&nbsp;&nbsp; AND wposts.post_status=&#039;publish&#039; 
&nbsp;&nbsp; ORDER BY RAND() 
&nbsp;&nbsp; LIMIT 6
</pre></pre></p>
<p>Using <a href="http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query">a custom select query</a> I added this block to the main sidebar template:</p>
<p><pre><pre>
 &lt;?php&nbsp;&nbsp;&nbsp;&nbsp; 
 $postcards = $wpdb-&gt;get_results(
&nbsp;&nbsp;&nbsp;&nbsp;&quot;SELECT wposts.* 
&nbsp;&nbsp;&nbsp;&nbsp; FROM $wpdb-&gt;posts wposts 
&nbsp;&nbsp;&nbsp;&nbsp; LEFT JOIN&nbsp;&nbsp;$wpdb-&gt;term_relationships rel 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ON wposts.ID=rel.object_id&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; WHERE rel.term_taxonomy_id = 139&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND wposts.post_type = &#039;post&#039; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND wposts.post_status=&#039;publish&#039; 
&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY RAND() LIMIT 6&quot;, OBJECT);&nbsp;&nbsp; 
&nbsp;&nbsp;?&gt;

&lt;?php if ($postcards): ?&gt;
&nbsp;&nbsp;&lt;?php foreach ($postcards as $post): ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php setup_postdata($post); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php $postcard_icon = c2c_get_custom(&#039;square&#039;);?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;img src=&quot;/wp-content/squares/
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php echo $postcard_icon ?&gt;&quot; border=&quot;0&quot; alt=&quot;&quot; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style=&quot;margin:1px;width:44%&quot; /&gt;&lt;/a&gt;

&nbsp;&nbsp; &lt;?php endforeach; ?&gt;
 &lt;?php endif; ?&gt;
 &lt;ul&gt;
 &lt;li&gt;&lt;a href=&quot;/category/postcards/&quot;&gt;all postcards...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre></pre></p>
<p>which produces six random icons in each reload.</p>
<h2>Navigation Link</h2>
<p>the last touch was adding a tab link to the main template. Since most templates are done by cycling the WordPress Pages, and the link I wanted to add was a category, I just hard coded it into the part of the template that does the navigation heck the home page is hard linked so I just added another list item there.</p>
<p>That&#8217;s all! I think it took longer to write this up than to code it. </p>
]]></content:encoded>
			<wfw:commentRss>http://cogdogblog.com/2009/04/29/postcards/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Wrangling WordPress MultiUser</title>
		<link>http://cogdogblog.com/2008/07/31/wrangling-wordpress-multiuser/</link>
		<comments>http://cogdogblog.com/2008/07/31/wrangling-wordpress-multiuser/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 06:31:08 +0000</pubDate>
		<dc:creator>Alan Levine</dc:creator>
				<category><![CDATA[Blog Pile]]></category>
		<category><![CDATA[nmc]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress dissected]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://cogdogblog.com/?p=2542</guid>
		<description><![CDATA[Besides manually updating six separate instances WordPress (to version 2.6) in the NMC fleet of sites, I also finally paid some over due attention to the version of WordPressMultiUser I have had up since November 2007. This tool some rustling to get it to the right version and also what had not been done in a while- making the front door. I am hardly a WPmu guru, certainly no bavatuesday&#8230; maybe a bavalatethursdaymorning. Most places running WPmu are doing it to provide a blog hosting service, like edublogs or the crazy stuff the Rev does at Mary Washington. My need was to have a series of separate sites hosted in WordPress w/o having to have an even bigger fleet of separate installs (Heck, maybe one day I can rope them all in under the WPmu hood). No these are all a series of online publications we have done at NMC [...]]]></description>
			<content:encoded><![CDATA[<p>Besides manually updating six separate instances WordPress (to version 2.6) in the NMC fleet of sites, I also finally paid some over due attention to the version of WordPressMultiUser I have had up since November 2007. This tool some rustling to get it to the right version and also what had not been done in a while- making the front door.</p>
<p>I am hardly a WPmu guru, certainly no <a href="http://bavatuesdays.com/">bavatuesday</a>&#8230; maybe a bavalatethursdaymorning. Most places running WPmu are doing it to provide a blog hosting service, like  <a href="http://edublogs.org/">edublogs</a> or the crazy stuff the Rev does at <a href="http://umwblogs.org/">Mary Washington</a>.</p>
<p>My need was to have a series of separate sites hosted in WordPress w/o having to have an even bigger fleet of separate installs (Heck, maybe one day I can rope them all in under the WPmu hood). No these are all a series of online publications we have done at NMC in the lasy 8 months, all using the slick <a href="http://www.futureofthebook.org/commentpress/">CommentPress</a> template. Developed by the <a href="http://www.futureofthebook.org/">Institute for the Future of the Book</a>, CommentPress provides a way to post a series of publication chapters as &#8220;blog&#8221; posts, but the special feature is that comments can be attached to individual chapters.</p>
<p>So we have things like the <a href="http://wp.nmc.org/horizon2008">2008 Horizon Report</a> in this format as well as the text of a keynote given by Howard Rheingold on <a href="http://wp.nmc.org/coevolution">Co-Evolution of Technology, Media and Collective Action</a>.</p>
<p>Until just a few minutes ago, these were separate little sites, but now I have at least a crude launch page for the entire WPmu site at <a href="http://wp.nmc.org">http://wp.nmc.org</a>.<br />
<span id="more-2542"></span><br />
Getting here meant first upgrading WPmu from what I had installed, version 1.3.3 to the just released 2.6 version (they bumped the numbers to be in line with the versions of regular WordPress). The documentation on <a href="http://codex.wordpress.org/Upgrading_WPMU">upgrading WPmu</a> is skimpy to say the least;  the ReadMe file said it had to be done incrementally from 1.3.3. to 1.5.1 and then to 2.6.</p>
<p>Okay that is not too much.</p>
<p>Except I spent 40 minutes poking arounf the <a href="http://mu.wordpress.org/">WPmu site</a> and the <a href="http://codex.wordpress.org/">WP Codex</a> w/o any luck. Finally I tossed <a href="http://twitter.com/cogdog/statuses/874193607">a tweet in frustration</a>, closed the lid, and went outside to do some real work. But the twitterverse shined and came through as <a href="http://twitter.com/kjarrett/statuses/874201082">Kevin Jarret pointed me</a> to <a href="http://trac.mu.wordpress.org/browser/tags">the Trac code side</a>.</p>
<p>Doh, right? How the _______ would anyone find that (without friends on twitter).</p>
<p>The upgrade process was pretty easy. Next was the fun part, starting to rip apart the template:</p>
<p><a href="http://wp.nmc.org/"><img src="http://cogdogblog.com/wp-content/uploads/2008/07/wpmu-ripped.jpg" alt="" title="wpmu-ripped" width="500" height="445" class="alignnone size-full wp-image-2543" /></a></p>
<p>This is just the start. </p>
<h3>(A) List of Blogs on Site</h3>
<p>One thing I needed was a list of all the blogs on the site (each a different publication), so I reached for the <a href="http://www.wpmudev.org/project/list-all">list-all plugin</a> which, as you might guess, returns output of all the blogs on a WPMU site, with some options for the order, and how many it spits out. I just put some code in my <code>index.php</code> template to make a block that would appear above any &#8220;posts&#8221; as an index to the whole site:</p>
<p><pre><pre>
&lt;div id=&quot;opening&quot;&gt;
&lt;h2&gt;Publications on this site&lt;/h2&gt;
&lt;ul&gt;
&lt;?php list_all_wpmu_blogs(&#039;&#039;, &#039;name&#039;, 
&#039;&lt;li&gt;&#039;, &#039;&lt;/li&gt;&#039;, &#039;last_created&#039;);?&gt;
&lt;/ul&gt;
&lt;/div&gt;
</pre></pre></p>
<p>The div was needed to add some styles so it would stand out a bit more. At first nothing happened; I got the header but no lists. I dug in the plugin to find the MySQL query and then ran it manually in phpMyAdmin- and sure enough, it returned no results. Then I looked at the query and my <code>wp_blogs</code> table and realized it had a condition looking for a value of <code>public=1</code> and in my table, these were all 0s. I can only guess that either my database did not get a right setting or maybe it was a new column added. My hack was to modify values in te database to set all values of public to be 1.</p>
<p>This was fine, but the query in the plugin also was returning a link to this same blog. So it was back to the plugin code, finding the query and adding an extra condition to the query on line 89:</p>
<p><code>AND blog_id > 1</code> so the main blog was skipped. That all worked. </p>
<p>The list-all plug in seems like a large chunk of code to do what I can see is a basic query, a lot of the stuff I did as described in <a href="http://cogdogblog.com/2008/02/14/wordpressing-dissected/">WordPress Dissected</a>. I plan to go back and just code in the query, which will allow my to pull and display other data, like the tag line, or the date published, or the number of comments, or&#8230;. With some MySQL know how, you can be a god. Sort of.</p>
<h3>(b) List of Posts From Within</h3>
<p>The next thing I wanted was a piece on the sidebar that would pull in content from among all the published papers within. There are a handful of plugins that do it on the WPMU Dev site, I chose <a href="http://1uthavi.adadaa.com/ada-wpmu-recent-posts-widget/">Ada WPMU Recent Posts</a> because it did so as a widget. I&#8217;m old school in my templates and have not done much with widgets except when forced to (like on WordPress.com). But since this blog was basic, I thought it would be worthwhile to get some widget experience.</p>
<p>It worked as advertised, and the options in the widget editor let me chose to pull Posts or Pages, and some options for ordering them.</p>
<p>The problem was a date order was not very interesting. When I create these Comment Press sites, I mend up cresting about 5-10 posts in a row in the same blog, because each one is  chapter/section. So in this list, the would be all from the same blog because I di each site at different times. </p>
<p>So I tweaked the code slightly, by editing again the MySQL query that grabbed the posts, by changing line 224 in ada_list-all-posts.php (this plug is ironically built on top of the list-all.php plugin I used inn section (A)) which sets the ordering of the results to be in reverse chnronological order&#8211; I changed the line that reads:</p>
<p><pre>$post_sql .= &quot; ORDER BY post_date_gmt DESC &quot; . $limit . &quot;&quot;;</pre></p>
<p>to read:</p>
<p><pre>$post_sql .= &quot;ORDER BY RAND() &quot; . $limit . &quot;&quot;;</pre></p>
<p>so rather than getting 7 or 10 posts in order of most recent, I now have a random selection form across the site.</p>
<p>This is still in play mode. I want to add more that will pull comments form within the site to the front, and eventually some sort of site wide tag thing going.</p>
<p>Wow, I love tinkering in WordPress. </p>
]]></content:encoded>
			<wfw:commentRss>http://cogdogblog.com/2008/07/31/wrangling-wordpress-multiuser/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>WordPress Alchemy- Blog in a Blog</title>
		<link>http://cogdogblog.com/2008/06/25/blog-in-a-blog/</link>
		<comments>http://cogdogblog.com/2008/06/25/blog-in-a-blog/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 13:28:35 +0000</pubDate>
		<dc:creator>Alan Levine aka CogDog</dc:creator>
				<category><![CDATA[Blog Pile]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[wordpress dissected]]></category>

		<guid isPermaLink="false">http://cogdogblog.com/?p=2411</guid>
		<description><![CDATA[In the vein of last February&#8217;s WordPress Dissection where I detailed the ripping apart and patching together of a WP template, here&#8217;s another bit if funny business I recently did in my favorite technology tool. More or less, I have a main WP site, with a nested second complete WP site sitting inside of it, yet they are themed and connected to each other in away to make them work as one. For the last two years, I have been running the NMC Campus Observer, a site that documents the projects and events of the NMC&#8217;s activity in Second Life. The design of this site is a blow apart of one of the more basic templates, Blix, as described back in May 2006 as WordPress Theme Philosophy. In 2006 there was not a great deal of things happening in education, and I spent a lot of time and energy writing, [...]]]></description>
			<content:encoded><![CDATA[<p>In the vein of <a href="http://cogdogblog.com/2008/02/14/wordpressing-dissected/">last February&#8217;s WordPress Dissection</a> where I detailed the ripping apart and patching together of a WP template, here&#8217;s another bit if funny business I recently did in my favorite technology tool.</p>
<p>More or less, I have a main WP site, with a nested second complete WP site sitting inside of it, yet they are themed and connected to each other in away to make them work as one.</p>
<p>For the last two years, I have been running the <a href="http://sl.nmc.org/">NMC Campus Observer</a>, a site that documents the projects and events of the NMC&#8217;s activity in Second Life. The design of this site is a blow apart of one of the more basic templates, Blix, as described back in May 2006 as <a href="http://cogdogblog.com/2006/05/04/wordpress-theme-philosophy/">WordPress Theme Philosophy</a>.</p>
<p><a href='http://sl.nmc.org/'><img src="http://sl.nmc.org/wp-content/uploads/2008/06/nmc-observer.jpg" alt="" title="nmc-observer" width="425" height="362" class="alignnone size-full wp-image-1144" /></a></p>
<p>In 2006 there was not a great deal of things happening in education, and I spent a lot of time and energy writing, researching, interviewing, setting up events. The nice thing about the continued interest among educators is that there are many more events and things going on that would be if interest to them. And I am seeing less of a need for me to be writing about them all; over the years I did recruit some guest writers, but most volunteers waned after a few posts.</p>
<p>Lets put it this way- I just peeked at the users page of the dashboard, and I have 350 posts credited to me; the next person after that has 18.</p>
<p>I&#8217;m tired of blogging there.</p>
<p>But the ideal thing has happened, with the expansion of NMC owned property in SL and many of it leased to other educators, they are now more frequently running their own events. I&#8217;ve been interesting in finding ways for them to announce/post their events; using a shared Google Calender was not all that successful. I was looking for a tool that people in the NMC sl community could use to post their events and would generate an RSS feed we could display on other web sites, or in SL using some of the RSS display systems that are out there. </p>
<p>A blog software is ideal for generating the feeds, IMHO. But I dont want to give access to the main blog site. So that&#8217;s when a tiny light bulb lit up- what if I set up a second WP inside a subdirectory of the primary site? this way, it could have a different set of users, and they could only edit their own calendar posts.</p>
<p>I themed it using the same template, it it even draws random banner images from the same directory the main site uses. The top navigation needed to be hard coded to link to the same sites as the main one. So while the main WP powered site is at http://sl.nmc.org/ there is an entire second WP install in <code>/calendar</code> so this site, the NMC Campus Community Events Calendar, is accessed via <code>http://sl.nmc.org/calendar/</code>:</p>
<p><a href='http://sl.nmc.org/calendar'><img src="http://sl.nmc.org/wp-content/uploads/2008/06/campus-calendar.jpg" alt="" title="campus-calendar" width="425" height="367" class="alignnone size-full wp-image-1145" /></a></p>
<p>I simplified the right sidebar and had to hard code the top green links since they are not generate by pages in the new blog. The other subtle thing I did was to create two custom fields; one contains the slurl for the event location, and the second one is a date/time in Pacific Time (aka linden Time) for the event. </p>
<p><img src="http://sl.nmc.org/calendar/images/wp-custom.jpg" alt="custom fields" /></p>
<p>Then in my templates, it uses the custom fields to display the SLURL as a hyperlink and convert the time to a nicer display format and also link it back to a World Time clock to provide local times for an event. See the <a href="http://sl.nmc.org/calendar/authoring.php">authoring guide</a> I provide for our calendar blog users.</p>
<p>I had all of this working a few weeks back, but there was a major missing piece. If people posted their events in the interior blog, how would the info get widely shared? it&#8217;s buried. I did not want to copy the post and paste it in as a new entry. I could embed an RSS feed in a sidebar of the main blog.</p>
<p>And then I had a <a href="http://bavatuesdays.com/">Jim Groom lightning idea flash</a> &#8212; use one of those plug-ins he raves about to post form one blog to another. It was easy to find on of Jim&#8217;s favorite plugins &#8212; <a href="http://devthought.com/wp-o-matic-the-wordpress-rss-agreggator/">WP-o-matic</a>, a tool that regularly checks an RSS feed for new content, and if found, it inserts it as republished content.</p>
<p>So now the main <a href="http://sl.nmc.org/">Campus Observer blog</a> has WP-o-matic installed, and if it finds a new feed from the <a href="http://sl.nmc.org/calendar">Campus Community Events blog</a>, it posts  anew entry to the main site. I have it configured so the title published in the main site links to the full entry in the Calendar site.</p>
<p>As an example, this post on  <a href="http://sl.nmc.org/calendar/2008/06/metanomics-kicks-off-season-two/">Metanomics Season 2</a> was posted into the calendar site, and <a href="http://sl.nmc.org/2008/06/20/metanomics-kicks-off-season-two/">automatically republished to the main blog</a>, with its title linked to the full story in the calendar blog.</p>
<p>Blog in a blog&#8211; I cannot vouch that anyone else might need to set up something like this, and likely there is some other way I could have rigged it in one blog, but hey, I was curious if this would work, and so far it looks good.</p>
]]></content:encoded>
			<wfw:commentRss>http://cogdogblog.com/2008/06/25/blog-in-a-blog/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>WordPressing Dissected: NMC Pachyderm Services</title>
		<link>http://cogdogblog.com/2008/02/14/wordpressing-dissected/</link>
		<comments>http://cogdogblog.com/2008/02/14/wordpressing-dissected/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 20:23:12 +0000</pubDate>
		<dc:creator>Alan Levine</dc:creator>
				<category><![CDATA[Blog Pile]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[using wp]]></category>
		<category><![CDATA[wordpress dissected]]></category>

		<guid isPermaLink="false">http://cogdogblog.com/2008/02/14/wordpressing-dissected/</guid>
		<description><![CDATA[Let me join the Jim Groom Kum-Ba-Ya I Love WordPress Chorus. In this least year, I&#8217;ve rolled out 3 NMC web sites that are published via WordPress, with each one going deeper into the bowels of the templates and just more jazzed how I can bend them to my will, casting CSS, PHP, plugins, MySQL to do my bidding. This is unlike drupal, where after a year I am still trying to figure out just how the heck it works and manages information. Its still a grey murky, opaque blue gumdrop box. I am trying to summon the drupal love, and it aint happening. But WordPress, you make me sing. In this blog post that portends to be a monster one of length, I am going to dissect a new site I worked in gory technical detail. On each of these sites, I have started with a standard template and [...]]]></description>
			<content:encoded><![CDATA[<p>Let me join the <a href="http://bavatuesdays.com/">Jim Groom Kum-Ba-Ya I Love WordPress Chorus</a>. In this least year, I&#8217;ve rolled out 3 NMC web sites that are published via WordPress, with each one going deeper into the bowels of the templates and just more jazzed how I can bend them to my will, casting CSS, PHP, plugins, MySQL to do my bidding. This is unlike drupal, where after a year I am still trying to figure out just how the heck it works and manages information. Its still a grey murky, opaque blue gumdrop box. I am trying to summon the drupal love, and it aint happening.</p>
<p>But WordPress, you make me sing. In this blog post that portends to be a monster one of length, I am going to dissect a new site I worked in gory technical detail.</p>
<p>On each of these sites, I have started with a standard template and slowly ripped the guts apart. So far, in the stable, is the <a href="http://sl.nmc.org/">NMC Campus Observer</a> which began as the <a href="http://www.kingcosmonaut.de/blix/">Blix template</a>. Then there is <a href="http://virtualworlds.nmc.org/">NMC Virtual Worlds</a> a child of the <a href="http://ericulous.com/2006/12/22/wp-theme-orange-web-20/">Orange 2.0 Theme</a>, and one where I learned to create multiple page templates, use custom fields to spawn content specific sidebars, and rolling my own database queries to get posts I really wanted. Our podcast site, <a href="http://web.nmc.org/conversations/">NMC Conversations</a> is probably the least modded, a few tweaks of the <a href="http://www.deanjrobinson.com/projects/redoable/">redoable theme</a>.</p>
<p>Now the thing I also love about WordPress is there are many levels of creativity you can operate at. You can simply blog, never tinker with the templates, and easily switch out themes like a new pair of socks. That&#8217;s great; it means you are focused on the content. Or you can get way down into the guts of the engine. Now I don&#8217;t do much with widgets- I think the concept is great for many bloggers as it offers a nice amount of flexibility on what you slap on your sidebar&#8230; but in my case, I find them horribly limited and boxed in.. cause I know I can easily script my way to something better.  Or you can somewhere in between- add your own graphics header, toss some specific text or web javascript code in the sidebar.</p>
<p>So as I get closer to the details, I remind you the stuff I am talking about is what you can do with your own code on a hosted server; while the WordPress.com service is fabulous (<a href="http://cogdogroo.wordpress.com/">I used it myself this year</a>), its simplicity comes at a price of severe lack of template tinkering. You really cannot do much there.</p>
<p><strong>BEFORE:</strong><br />
<a href="http://www.pachyderm.org/about"><img src='http://cogdogblog.com/wp-content/uploads/2008/02/pachyderm-old.jpg' alt='pachyderm-old.jpg' /></a></p>
<p>The site I am going to talk about is the <a href="http://pachyderm.nmc.org/">NMC Pachyderm Services web site</a>, which replaces a static HTML tabled encrusted, hand code the navigation links&#8221; Pachyderm.org web site, which was not all that bad, but once you go to database driven template sites, it just hurts to hand code an HTML site.</p>
<p><strong>AFTER:</strong><a href="http://pachyderm.nmc.org/"><img src='http://cogdogblog.com/wp-content/uploads/2008/02/pachyderm-services-new.jpg' alt='pachyderm-services-new.jpg' /></a></p>
<p>So I am going to talk alot about the mangling I did in the templates along with some plugins I deploy (and tweak too). I should say I go about waist deep into the CSS and full body dive into the PHP code of the templates. And for some of these sites, I make a bend away from the standard format of blog as reverse chronological series of &#8220;posts&#8221;. I make web sites, not blogs.</p>
<p>Some of this stuff may get nitty gritty in detail, but I am intrigued to see if I can document all the little pieces that came together for this site. To be honest, these really develop organically, and sometimes change/evolve with more content dumped in.</p>
<p><span id="more-2202"></span></p>
<p>These projects start usually with a lot of scribbles in real paper, and boxes and lines, as I try to flesh out some sense of the information types. Then I start <a href="http://themes.wordpress.net/">browsing WordPress themes</a>. I am not always looking for one that &#8220;looks good&#8221; out of the box, but more, one that seems to have a general layout and design elements I have in mind. Everything, from colors to graphics to sidebar structure, is malleable.</p>
<p>In this case, I had access to a great set of themes shared with my by <a href="http://incsub.org/blog/">James Farmer</a>. The <a href="http://www.briangardner.com/themes/vertigo-blue-wordpress-theme.htm">Vertigo theme by Brian Gardner</a> jumped out- it has appropriate color elements, but also a clean text style, and 2 sidebars to play with. I also eyeball how complex the theme files are; this one is elegant with a basic set of files. </p>
<p><img src='http://cogdogblog.com/wp-content/uploads/2008/02/vertigo.jpg' alt='Vertigo theme' /></p>
<p>The header text is all graphics, so it could be almost any type style and the footer is a Hemingway style. At this point I think I may get lucky and not have to do much to the template. But that&#8217;s no fun&#8230;</p>
<p>In looking at the content needs, the Pachyderm site would need basic intro static content, <a href="http://pachyderm.nmc.org/category/news/">time stamped news items</a>, and <a href="http://pachyderm.nmc.org/category/showcase/">a collection of examples for the &#8220;gallery&#8221;</a>. It might not need more, but that was enough to get rolling.</p>
<p>So in the next chunk, I am going to talk about all the mods I did on the front page, using the numbered spots as a key:</p>
<p><img src='http://cogdogblog.com/wp-content/uploads/2008/02/pachy-services-web.jpg' alt='pachy-services-web.jpg' /></p>
<p><strong>(1) Header Graphics</strong><br />
These changes are easy, you just need to find the originals, check their dimensions, and then create new versions, and replace them in the theme&#8217;s images folder. For the Vertigo theme, the main banner is all graphic, so I could use any font to make the <a href="http://pachyderm.nmc.org/wp-content/themes/vertigo-blue-3column/images/header.gif">pachyderm services background header</a>. In the Pachyderm site, the font for the main title is &#8220;Orater Std&#8221; and the tagline font is Monotype Corsiva. The <a href="http://pachyderm.nmc.org/wp-content/themes/vertigo-blue-3column/images/logo.gif">left pachyderm logo</a> was a bit of editing to get a good mask for the icon. A sign of a quality template to me is that the author has provide PhotoShop versions of this graphics (e.g. <a href="http://pachyderm.nmc.org/wp-content/themes/vertigo-blue-3column/images/logo_blank.gif">the logo blank</a>), so the sizes and background colors are all preserved.</p>
<p><strong>(2) The static front content</strong><br />
The focus of this site is not a regular stream of &#8220;blog posts&#8221;, so I used <strong>Options</strong> -&gt; <strong>Reading</strong> the feature that allows make the front of the site display this static content from a WordPress page. This is the second or third time I have used this approach for a site that has a consistent front face so the primary information is not the new &#8220;posts&#8221; but information that does not change over time. The &#8220;posts&#8221; are there, but are now relegated to the sidebars as the content that are newly added are either  <a href="http://pachyderm.nmc.org/category/news/">news items</a>, and <a href="http://pachyderm.nmc.org/category/showcase/">showcase items</a>.</p>
<p><strong>(3) Fixing the Top Navigation Links</strong><br />
On this and many templates, automatic navigation within the blog is enabled by WP code that loops through all of the pages created, and attempts often to put  a lot of content in a small box. I had plans to put those links elsewhere. So rubbing together the template tools, we go to <strong>Presentation</strong> -&gt;  <strong>Theme Editor</strong>, and then open up the header.php file to change these lines:</p>
<p><pre><pre>
&nbsp;&nbsp;&lt;div id=&quot;headerright&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;&lt;?php echo get_settings(&#039;home&#039;); ?&gt;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php wp_list_pages(&#039;title_li=&amp;depth=1&#039;); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;&lt;?php bloginfo(&#039;rss2_url&#039;); ?&gt;&quot;&gt;RSS&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;
&nbsp;&nbsp;&lt;/div&gt;
</pre></pre></p>
<p>This will create navigation from all WP pages, and then tack on in the beginning a home link and RSS on the end,  but I opted for hard coding a smaller set since I only wanted a handful on the top navigation (yes, I could have used the options on <code>wo_list_pages</code> to exclude pages by ids, but straight HTML here is less work. Plus I&#8217;d have to keep adding excludes as pages were added).<br />
<pre><pre>
&lt;div id=&quot;headerright&quot;&gt;
&nbsp;&nbsp;&lt;ul&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;&lt;?php echo get_settings(&#039;home&#039;); ?&gt;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;/about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;/contact&quot;&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;&lt;?php bloginfo(&#039;rss2_url&#039;); ?&gt;&quot;&gt;RSS&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&lt;/ul&gt;
&lt;/div&gt;
</pre></pre></p>
<p>(4) <strong>Navigation Links</strong><br />
A normal blog has a sidebar block listing categories and another one listing static wordpress pages; for this sites purposes, I have blended them together under an &#8220;Explore&#8221; heading. I somewhat did it the lazy way, just shoving together in one &lt;ul&gt; list the pages and then the categories. I hope the order does not mattter, in that case I&#8217;d have to do some more gymnastics in PHP (but I know I can take that on).</p>
<p><pre><pre>
&lt;li id=&quot;Pages&quot;&gt;
&lt;h2&gt;Explore&lt;/h2&gt;
&lt;ul&gt;
&lt;?php wp_list_pages(&#039;title_li=&amp;depth=1&#039;); ?&gt;
&lt;?php wp_list_cats(&#039;sort_column=name&#039;); ?&gt;
&lt;/ul&gt;
&lt;/li&gt;
</pre></pre></p>
<p>(5) <strong>Static Content Links</strong><br />
Nothing special here, just to show you can add pretty much what you need in HTML to the template; in this case, a top block of specific links (well I could have used a blogroll, but for 4 link, straight HTML is easy). and the &#8220;About&#8221; block.</p>
<p>You may have to have some savvy of the CSS- in this case, all of the &lt;a&gt;&#8230;&lt;/a&gt; links are set as block, meaning they sit alone on a line (this is to handle the rollover effects).</p>
<p>(6) <strong>Random Post from Category</strong><br />
Now we really roll of our sleeves and do custom code. We have a category of posts for our <a href="http://pachyderm.nmc.org/category/showcase/">pachyderm showcase</a> and want to randomly put one on the front page. There might be a plugin that does this (I looked but did not find one that can pull from a category), so I rolled my own code.</p>
<p>Put your safety glasses on, this gets pretty messy.</p>
<p>I&#8217;ve learned this from the WP Codex on <a href="http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query">Displaying Posts Using a Custom Select Query</a>. More or less you figure out how to query the database to get what you want (usually a bunch of trial error tests in phpMyAdmin). Some of the query stuff is tricky, as the wp_posts table contains not only blog posts, but page content, and even rows for the media uploaded, so you have to make sure you get the right things back. And fishing from categories is not as easy as it used to be, so it requires a join to another table where the categories are related to the posts.</p>
<p>I should add that I am using another advanced technique for the posts that are Pachyderm Showcase items- I use custom fields for two extra pieces of data for each post in this category (for reference, <a href="http://pachyderm.nmc.org/showcase/fox-harris-amset/">see the corresponding post</a>):</p>
<p><img src='http://cogdogblog.com/wp-content/uploads/2008/02/custom-fields.jpg' alt='custom-fields.jpg' /></p>
<p>The value of &#8220;icon&#8221; is a URL for a square icon used in the entry. These showcase items had already been done <a href="http://www.nmc.org/spotlights/pachyderm">on the NMC drupal site</a>, so I just link to those existing ones.</p>
<p>The value for &#8220;miini&#8221; is a file name of a 220 pixel wide icon that is used for the front page preview- I have these stored in a specific directory inside <code>/wp-content/showcase</code>, e.g. the one for the <a href="http://pachyderm.nmc.org/wp-content/showcase/fox-harris.jpg">Fox Harris entry</a>.  In hindsight, I could have gotten away with one custom field value and made twp WordPress special directories for the image. </p>
<p>Anyhow, where I need these in my code, I use the <a href="http://www.coffee2code.com/wp-plugins/">Get Custom Field Values plugin</a> to get the values. For example, to embed the icons in a post page, I use:</p>
<p><pre><pre>
&lt;?php 
$showcase_icon = c2c_get_custom(&#039;icon&#039;);&nbsp;&nbsp; 
if ($showcase_icon) echo &#039;&lt;img src=&quot;&#039; . 
&nbsp;&nbsp;$showcase_icon . &#039;&quot; alt=&quot;&quot; 
&nbsp;&nbsp;class=&quot;right&quot; /&gt;&#039;;
?&gt;
</pre></pre></p>
<p>This code will embed an icon only if there is a value for the appropriate custom field.</p>
<p>I cannot underscore enough how much flexibility custom fields provide. I use it extensively on the NMC Virtual Worlds site (see the <a href="http://cogdogblog.com/2007/01/16/making/">write-up I did for that site</a>)</p>
<p>But back to this front page random post inserter, here is the whole chunk that does this section, with some explanatory comments&#8230;</p>
<p><pre><pre>
&lt;?php 
/* Only display on pages that are front (id 3) or the About page */ 
if ( is_page(&#039;3&#039;) or&nbsp;&nbsp;is_page(&#039;about&#039;)) : ?&gt;

&lt;li id=&quot;Showcase&quot;&gt;
&lt;h2&gt;Featured Pachyderm&lt;/h2&gt;
&lt;ul&gt;
&lt;?php
// Here is the hairy MySQL query to get one post
// selected randomly from id# 4 (category id)
 $pageposts = $wpdb-&gt;get_results(
&nbsp;&nbsp; &quot;SELECT wposts.* FROM $wpdb-&gt;posts wposts 
&nbsp;&nbsp;&nbsp;&nbsp; LEFT JOIN&nbsp;&nbsp;wp_term_relationships rel 
&nbsp;&nbsp;&nbsp;&nbsp; ON wposts.ID=rel.object_id 
&nbsp;&nbsp;&nbsp;&nbsp; WHERE rel.term_taxonomy_id = 4 
&nbsp;&nbsp;&nbsp;&nbsp; AND wposts.post_type = &#039;post&#039; 
&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY RAND() Limit 1&quot;, 
&nbsp;&nbsp;&nbsp;&nbsp; OBJECT);
 ?&gt;

&lt;?php if ($pageposts): ?&gt; // loop over results
&lt;?php foreach ($pageposts as $post): ?&gt; // each result
&nbsp;&nbsp;&lt;?php setup_postdata($post); ?&gt; // get variables

&nbsp;&nbsp;// use plugin to get value of custom field
&nbsp;&nbsp;&lt;?php $showcase_preview = c2c_get_custom(&#039;mini&#039;);?&gt;

&nbsp;&nbsp;// only execute if something was found
&nbsp;&nbsp;// embed the graphic and link
&nbsp;&nbsp;&lt;?php if ($showcase_preview): ?&gt;
&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; 
&nbsp;&nbsp;title=&quot;link to &lt;?php the_title(); ?&gt;&quot;&gt;
&nbsp;&nbsp;&lt;img src=&quot;/wp-content/showcase/&lt;?php echo $showcase_preview ?&gt;&quot; 
&nbsp;&nbsp;border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/li&gt;

&nbsp;&nbsp;&lt;?php endif; ?&gt;
&nbsp;&nbsp;
&nbsp;&nbsp;&lt;!-- print a title and link --&gt;
&nbsp;&nbsp;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title=&quot;link to &lt;?php the_title(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/strong&gt;&lt;/li&gt;
&nbsp;&nbsp;
&nbsp;&nbsp;// use the RSS version to print a mini blurb, first 35 characters
&nbsp;&nbsp;&lt;li&gt;&lt;em&gt;&lt;?php the_content_rss(&#039;&#039;, false, &#039;&#039;, 35); ?&gt;...&lt;/em&gt;&lt;/li&gt;

 &lt;?php endforeach; ?&gt; 
 &lt;?php endif; ?&gt;
 
 &lt;!-- more showcases link --&gt;
&nbsp;&nbsp;&lt;li class=&quot;more&quot;&gt;&lt;a href=&quot;/category/showcase/&quot;&gt;more pachyderms...&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp; &lt;/ul&gt;

&lt;/li&gt;
&lt;?php endif?&gt;
</pre></pre></p>
<p>Its pretty hairy, yes, but exactly what we needed.</p>
<p>(7) <strong>Move Search Field</strong><br />
The Vertigo template has the search field in the footer; I justed moved it higher on the page. I believe search boxes ought to be &#8220;above the fold&#8221;.</p>
<p>(8) <strong>Custom Code for Recent News</strong><br />
As another variation of the approach in item 6, I wanted to display headlines for posts that re only in the &#8220;Pachyderm News&#8221; category. But the twist here was using some code to rework the date display like it was on the old Pachyderm.org site (it was not critical, more of, &#8220;I wonder if this can be done&#8221;).</p>
<p>This custom query is not as complex as the previous example, so I used the <code><a href="http://codex.wordpress.org/Function_Reference/WP_Query">WP_QUERY</a></code> function that allows me to use the standard WP method and just add some parameters, in this case to select from a specific category, and return 5 items.</p>
<p>We then loop over each one, use the  <code><a href="http://codex.wordpress.org/Formatting_Date_and_Time">the_time()</a></code> function to reformat the timestamp, and make a list of links.</p>
<p><pre><pre>
&lt;li id=&quot;Recent&quot;&gt;
&lt;h2&gt;Recent News&lt;/h2&gt;
&lt;ul&gt;
&lt;!-- use WP_QUERY to select by category and count --&gt;
&nbsp;&nbsp;
&lt;?php $my_query = new WP_Query(&#039;category_name=news&amp;showposts=5&#039;);?&gt;
&nbsp;&nbsp;
&nbsp;&nbsp;&lt;?php while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post();?&gt;
&nbsp;&nbsp;&lt;!-- display link, date reformatted, and title --&gt;
&nbsp;&nbsp;&lt;li&gt;&lt;a title=&quot;&lt;?php echo the_title() ?&gt;&quot; 
&nbsp;&nbsp;href=&quot;&lt;?php the_permalink() ?&gt;&quot;&gt;&lt;strong&gt;
&nbsp;&nbsp;&lt;?php the_time(&#039;m.d.Y&#039;) ?&gt;&lt;/strong&gt; 
&nbsp;&nbsp;&lt;?php echo the_title() ?&gt;&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp;&lt;?php endwhile; ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&lt;li class=&quot;more&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;http://pachyderm.nmc.org/category/news/&quot;&gt;more...&lt;/a&gt;&lt;/li&gt;
&nbsp;&nbsp; &lt;/ul&gt;
&lt;/li&gt;
</pre></pre></p>
<p>(9) <strong>Flickr Badge</strong><br />
I love adding random photos to a page for freshness. Here I use <a href="http://flickr.com/badge.gne">flickr&#8217;s badge code</a> to pull from photos in <a href="http://www.flickr.com/photos/newmediaconsortium/">an NMC general photo account</a> only <a href="http://www.flickr.com/photos/newmediaconsortium/tags/pachypix/">photos tagged as pachypix</a>.</p>
<p>You are not stuck with the cut and paste code. I yank out some chrome and stuff I dont want, and you can edit the javascript line:</p>
<p><code>http://www.flickr.com/badge_code_v2.gne?count=4&#038;display=random&#038;siz....</code)</p>
<p>to sat tel it a different number of photos to pull. I use this method on other sites; for example, if you use the badge creation tool to work on a public tag, flickr does not offer random as a display option. But if you edit the value here... it works.</p>
<p>I did not want the photos on every page, so the code is wrapped in a PHP command to specify which pages it appears on:</p>
<p><pre><pre>
&lt;?php /* If this is the frontpage */ if ( is_page(&#039;3&#039;)) : ?&gt;
&lt;li id=&quot;flickr&quot;&gt;
&lt;h2&gt;Pachy Pix&lt;/h2&gt;
&lt;!-- Start of Flickr Badge --&gt;
&lt;style type=&quot;text/css&quot;&gt;
#flickr_badge_uber_wrapper a:hover,
#flickr_badge_uber_wrapper a:link,
#flickr_badge_uber_wrapper a:active,
#flickr_badge_uber_wrapper a:visited {text-decoration:none !important; 
&nbsp;&nbsp; background:inherit !important;color:#3993ff;}
#flickr_badge_wrapper {}
#flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, 
Sans serif !important; color:#666666 !important;}
&lt;/style&gt;
&lt;table id=&quot;flickr_badge_uber_wrapper&quot; 
cellpadding=&quot;0&quot; cellspacing=&quot;10&quot; border=&quot;0&quot;&gt;
&lt;tr&gt;
&lt;td&gt;&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; id=&quot;flickr_badge_wrapper&quot;&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.flickr.com/badge_code_v2.gne?count=4
&amp;display=random&amp;size=t&amp;layout=v&amp;source=user_tag
&amp;user=17942035%40N00&amp;tag=pachypix&quot;&gt;
&lt;/script&gt;
&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;!-- End of Flickr Badge --&gt;
&lt;/li&gt;
&lt;?php endif; ?&gt;
</pre></pre></p>
<p><strong>(10) Embedded RSS Feed</strong><br />
We wanted to include headlines/updates from the <a href="http://www.pachyforge.org/">Pachyderm Developer Community (PachyForge)</a>. There are tons of WP plugins for doing this, but since I know <a href="http://feed2js.org/">Feed2JS</a> inside out, I just use the <a href="http://feed2js.org/index.php?s=php">PHP version of it to embed feeds</a> as needed.</p>
<p>I have a central stored location for Feed2JS code that is on our web server, and can access it from any one of our 8 or 9 virtual domains by knowing the path (obscured below for obvious reasons). </p>
<p><pre><pre>
&lt;li id=Pachyforge&quot;&gt;
&lt;h2&gt;PachyForge News&lt;/h2&gt;
&lt;?php 
// declare Feed2Js variables
$src = &#039;http://www.pachyforge.org/index2.php?
&nbsp;&nbsp;&nbsp;&nbsp; option=ds-syndicate&amp;version=1&amp;feed_id=2&#039;;

$chan = &#039;n&#039;;
$num = 5;
$desc = 0;
$html = &#039;n&#039;;
$tz = -8;
$utf = &#039;y&#039;;
$date = &#039;n&#039;;
$targ = &#039;y&#039;;
$pc = &#039;y&#039;;

// use&nbsp;&nbsp;feed2php include file
require(&#039;/var/www/........./feed2js/feed2php.inc&#039;);
?&gt;&nbsp;&nbsp; 

&lt;span class=&quot;more&quot;&gt;
&lt;a href=&quot;http://www.pachyforge.org/&quot;&gt;more...&lt;/a&gt;
&lt;/span&gt;
&lt;/li&gt;
</pre></pre></p>
<p>Since my install of Feed2JS caches feeds (well all versions fo) but are cleaned on a daily basis, this is really stable.</p>
<p><strong>(11) Gutted Footer</strong><br />
The footer on the Vertigo template is pretty much for blog content, with more lists of recent posts, categories, etc, in 4 columns that is typical for templates following <a href="http://warpspire.com/hemingway">Hemingway</a>. It s anice design style, but the content as is was not what we needed.</p>
<p>So I put a right aligned NMC logo in column 1, put NMC contact info in column 2, the basic links generated by the WP blogrool in 3, and a combo of RSS links and credits in column 4. Its pretty flexible what you can do. And you are not stuck at all with the stock footer.</p>
<h3>But Wait There is More!</h3>
<p>Beyond this template mucking, I made use of two plugins I really found useful that generate special pages for our site.</p>
<p><a href="http://green-beast.com/blog/?page_id=136">Secure and Accessible PHP Contact Form</a> provides an excellent web form for collecting feedback from visitors, and does away with putting email address links on your site:</p>
<blockquote><p>This powerful yet easy-to-install PHP contact form features exceptional accessibility and usability while still providing extensive anti-spam and anti-exploit security features. A marriage of communication and peace-of-mind</p></blockquote>
<p>It is dead easy to configure, with a lot of options for features and design. So it creates our <a href="http://pachyderm.nmc.org/contact/">Pachyderm Services Contact page</a>. I am using this now on all new WP sites I do because it is so useful,</p>
<p>The next one I found is new; we wanted to have a Frequently Asked Questions section on the site. I could have coded it as a static page or series of pages with perhaps sub categories. But this seemed to call for a lot of manual page creation, and I wanted to turn over the content creation / management to NMC staff.</p>
<p>So enter the <a href="http://knowledgeconstructs.com/wordpress-plugins/faq-tastic/">FAQ-Tastic plugin</a> which provides a Wp admin interface for creating, managing, editing the FAQ. So here is the final <a href="http://pachyderm.nmc.org/faq/">Pachyderm Services FAQ </a>as I created it-- well, not final, it is a work in progress.</p>
<p>This took a little bit of extra leg work and tweaking. So first, in FAQ-Tastic, I create a collection of question groups, and associate them with the main FAQ web page- this means each Q&#038;A will be generated as a separate sub page:</p>
<p><img src='http://cogdogblog.com/wp-content/uploads/2008/02/faq-q-groups.jpg' alt='faq-q-groups.jpg' /></p>
<p>and the links on the right allow access to edit, add new questions to that group:</p>
<p><img src='http://cogdogblog.com/wp-content/uploads/2008/02/faq-questions.jpg' alt='faq-questions.jpg' /></p>
<p>You control the order by dragging and dropping the green bars. Editing is easy, well you need to roll your own HTML if you want something more than text. but it works.</p>
<p>The trickier part was on formatting the FAQ page... it is essentially a list of tags specific for this plug-in, that I put below headers to put in the right group order:</p>
<p><pre><pre>
&lt;h4&gt;How do I?&lt;/h4&gt;
[faq summary How Do I?]

&lt;h4&gt;Authoring&lt;/h4&gt;
[faq summary Authoring]

&lt;h4&gt;Working with Media&lt;/h4&gt;
[faq summary Media]
</pre></pre></p>
<p>where the "summary" command means print the question linked to the answer page, and the third part of the tag is the name of the question group.</p>
<p>I also had issues with the output since it puts them into an HTML unordered list, but then uses &lt;h3&gt; tags, which looked butt ugly on this site. So I just went down into the plugin files and found the php files that generate output, and cleaned it up to make them just bold, and remove extraneous line breaks that mangled the output.</p>
<p>The last little trick was the problem that landing on an Answer page provided no link back to the index. So again, I rolled up my  sleeves and edited the page.php template:</p>
<p><pre><pre>
 &lt;?php&nbsp;&nbsp;
if ($post-&gt;post_parent==&quot;43&quot;) 
echo &#039;&lt;p style=&quot;font-size:95%; text-align:right&quot;&gt;
&lt;a href=&quot;/faq&quot;&gt;&amp;laquo; return to pachyderm faq&lt;/a&gt;&lt;/p&gt;&#039;;
?&gt;
</pre></pre></p>
<p>43 is the WP id for the <a href="http://pachyderm.nmc.org/faq/">main FAQ page</a> so if I am on a child page of that, which is what the plugin creates, I insert a return link.</p>
<p>That is about all my tired mind can think of for the details of how this site works. All in all, crafting these WP sites is a work of sheer joy, and each one I learn new techniques I roll into the next one. With your own WP site, there is no limit to what you can do, and you can arm twist WordPress into running any kind fo site, one that is easy to update, is dynamic, and sometimes even darn pretty to look at.</p>
<p>I love WordPress like no other ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://cogdogblog.com/2008/02/14/wordpressing-dissected/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
	</channel>
</rss>

