Woah, it is ending? ds106 is almost over? Sigh. Well, sincr i have blog posts dribbled over the last few months, I thought about organizing it a bit better here in the doghouse- it’s not quite archiving, but it does feel like the suitcase needs help to get closed.
cc licensed ( BY NC SD ) flickr photo shared by demandaj
What I talk about below in likely un-reproducible code is what I did to generate http://cogdogblog.com/tag/ds106
Doing this has been part of some other WordPress tinkering around here. The current template here has 2 widgetized sidebars, and I shifted the rightmost one to be the “standard” one that appears on all pages. The left side one, by default, will have blog related things, but I also now use it on a few templates to create more relevant bits.
To allow for a new widget, I edited my functions,php template for the place where it generates 2 sidebars:
1 2 |
if ( function_exists('register_sidebar') ) register_sidebars(2); |
This is how the template I use creates 2 sidebars (this is the simple way, they are called “sidebar 1” and “sidebar 2” in the widget editing screen; other themes may do this differently to name the widgets).
So I just bumped it to create 3 widget areas.
1 2 |
if ( function_exists('register_sidebar') ) register_sidebars(3); |
All of the content is already organized via the ds106 tag used- but the basic template for tagged content is not all that special.
So what I want now is a template specific for my tag- so I make a copy of say category.php and named it tag-ds106.php, which tells wordpress to only use this template for tag archives of ds106.
For the top part of the template, I update the main header for the title I want, and use some conditionals to display an intro paragraph only if this is the first page someone is viewing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<h1 class="page-title">ds106: Digital Storytelling Tagged Stuff</h1> <?php if ( $paged < 2 ):?> <div class="entry"> <p> What flows below are the bits, ideas, experiments, projects, assignments, and assorted weird ideas all associated with my participation in <a href="http://ds106.us/">ds106</a>, the most innovative open course every, first launched in January 2011. </p> </div> <?php endif; ?> |
All of the loop stuff I leave as is, it is the standard stuff a template does to spit out content.
To use my custom sidebars, I change:
1 |
<?php get_sidebar(); ?> |
to read
1 |
<?php get_sidebar('ds106'); ?> |
This tells WordPress to not use the sidebars.php template, but instead to use sidebars-ds106.php, a custom sidebar template.
This is easy. I make a copy of the sidebars.php statement, and for the code in the first sidebar, I find the line that reads:
1 |
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : |
This tells wordpress to use Sidebar 1, but now I want it to use 3. One edit:
1 |
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : |
And now all I have to do is populate the stuff I want in Widget sidebar 3 to show what I want on my ds106 tag pages.
Your mileage will most likely vary with the structure of your templates, but as a rule, you can always override a category or tag archive by this method. For another case, I am using the category I created to document by summer road trip into a custom archive for CogDog Odyssey.
Ahhh, ds106, packed and organized.