WordPress Tip: Using the same template across multiple category, tag, and author pages

.........................................................

Sharing Category Templates

Sharing Category Templates

WordPress has an amazing theming system. It’s not perfect, but if you know the right things you can bend it to your will and do a lot of cool things. One great thing about it is the template hierarchy; WordPress basically allows you to create custom templates for categories, tags, authors, etc.

For example, if I add category.php to my theme, all category pages will now be styled according the structure within the category.php file. Now, let’s say I have a category called “Photos” that I wanted to look a little different from the rest. (Let’s assume the category ID for “Photos” is 6). All I have to do is add category-6.php to my theme, modify it to whatever, and the “Photos” category page will switch to this new template. Cool? Definitely.

With a system like this, you could technically customize your site to the point where the every category, author, tag, etc. page has a unique look and feel. But, that’s quite a lot of work and in most cases unnecessary. There may be cases though, where you want a small subset of categories to have a unique look, and you want these pages to share this look. Unfortunately WordPress doesn’t allow different pages to share templates. (Intuitively, I would think that something like creating a file called category-6,7,8.php [or similar] would apply this template to categories 6, 7, and 8). You could technically set up separate files (category-6.php / category-7.php / category8.php) and just copy and paste the code across all of them, but that’s a maintenance nightmare. A single change will have to be copied over multiple times, and that’s just annoying.

There are a few ways around this. One of easy ways is to use Idealion’s Category Enhancements plugin. Alternatively, if you want a more theme-level solution, follow the steps below. This is something I discovered while building out the image gallery pages for The Boar (links of what I came up with are at the bottom).

1. In your theme folder, create the category files for the categories you want to apply the custom template to.

  • Let’s assume we want to apply it to the categories “Portrait Photography” (ID: 5) and “Nature Photography” (ID: 12).
  • In this case we’d create category-5.php and category-12.php

2. In the category template files (category-5.php & category-12.php), add the following:

<?php require_once('common_template.php'); ?>

3. Create a generic category template: common_template.php

4. Then in the common_template.php, add the following:

<?php get_header(); ?>
<?php echo 'Hello World!'; ?>
<!-- The rest of your custom template goes here -->
<?php get_footer(); ?>

5. Now, if you navigate to http://your-site.com/?cat=5 and http://your-site.com/?cat=12, you’ll notice that their look will mirror what you included in common_template.php

I should note that this approach isn’t limited to category templates; you can use this with author and tags templates as well. Technically, with this approach you could combine multiple categories and tags, as well (though if you do, be wary of category- and tag-specific functions and make use of conditional tags).

You can see an example of this in action at the links below:

Sample files you work from. Download them, rename the extension to .php and throw them into your template folder.

Thoughts, questions, suggestions? Leave a comment below or send me an email.

Continue Reading

Edit Flow Project: Stage 1 beta release

.........................................................

Note: this is cross-posted from a post that I wrote on the CoPress blog.

This past weekend, we released the beta version of Stage 1 (Custom Post Statuses) of the Edit Flow Project, a plugin aiming to improve the WordPress Admin Interface for a multi-user newsroom’s editorial workflow.

The main goal of this stage was to “improve posts statuses by allowing custom statuses.” WordPress, by default, only allows for two statuses for posts during the editing process: “Draft” and “Pending Review”. These statuses are not very descriptive nor do they make it easy to track a story as it moves through a newsroom’s often complex, multi-level workflow.

With the release of Stage 1 of Edit Flow, WordPress users can now assign custom statuses to posts, giving them more control over the state of their content.

Continue Reading

Co-Authors Plus Upgraded to v1.2

.........................................................

I released a new update for Co-Authors Plus today. The version number gets bumped to v1.2 and includes mostly fixes, the major one being compatibility with WordPress 2.8. Details about changes below. To upgrade, click the upgrade link in your WordPress Admin dashboard, under Plugins, or download the latest version here.

Any issues, leave a comment, or send me a message.

  • FIX: Added compatibility for WordPress 2.8
  • FIX: Added new template tags (getthecoauthormeta & thecoauthor_meta) to fix issues related to displaying author info on author archive pages. See Other Notes for details.
  • FIX: Plugin should now work for plugins not using the ‘wp_’ DB prefix
  • FIX: Coauthors should no longer be alphabetically reordered when the post is updated
  • FIX: Plugin now used WordPress native AJAX calls to tighten security
  • DOCS: Added details about the new template tags

Continue Reading

Imprint Cover Design – June 12, 2009

.........................................................

Cover design I did for Imprint this week. This will sadly be my last.

Cover for Imprint, volume 32, issue 4, published June 12, 2009

Cover for Imprint, volume 32, issue 4, published June 12, 2009

Continue Reading

Imprint Cover Design – May 29, 2009

.........................................................

Cover design for the week for Imprint. And as an added bonus, a snapshot of the Distractions (Puzzle/Fun/etc.) page.

Cover for Imprint, volume 32, issue 3, published May 29, 2009

Cover for Imprint, volume 32, issue 3, published May 29, 2009

Distractions page - Imprint, volume 32, issue 3, published May 29, 2009

Distractions page - Imprint, volume 32, issue 3, published May 29, 2009

Continue Reading

Imprint Cover design – May 14, 2009

.........................................................

Cover design for the week for Imprint. I had fun with the bus. My favourite bit is the bus.

Cover for Imprint, volume 32, issue 2, published May 14, 2009

Cover for Imprint, volume 32, issue 2, published May 14, 2009

Continue Reading

Co-Authors Plus v1.1.3 released

.........................................................

Today, I released the first public version of the Co-Authors Plus plug-in for WordPress, which allows multiple authors to be added to Posts and Pages. The plug-in is an extension of the Co-Authors plug-in created by Weston Ruter.

The plug-in is a result of a this conversation, namely how to deal with users as your userbase grows, a genuine problem facing newspapers, magazines, and community sites using WordPress, and a problem I’ve been toying with for a while now while working on website for The Boar.

Currently, WordPress allows only a single author per Post/Page. Weston’s plugin fixed that problem. However, the other design problem it failed to overcome was the usage of drop-downs to assign users to Posts/Pages. Once you scale up to 10+ users, this starts to become unmanageable (and when you start pushing 100+ it really becomes a problem).  Granted, the typical blog would not deal with this problem. Granted, the design is only a problem when you dealing with a large number of users, and therefore not something the average blog would worry about.

So, what’s the main difference between Co-Authors and Co-Authors Plus?

The most notable difference is the replacement of the standard WordPress authors drop-downs with search-as-you-type/auto-suggest/whatever-you-call-them input boxes. As a result, major bits of the JavaScript code was changed to be more jQuery-friendly. Eventually, I hope to include the ability to add new Users from within the Edit Post/Page screen, to fix another piece of broken workflow, and possibly Gravatar support.

Find it here: http://wordpress.org/extend/plugins/co-authors-plus/

Continue Reading

Magazine Trends: Online (2008)

.........................................................

Magazine Rack, Munich Airport by inky

This article was originally written in August 2008 as a submission for the Digital Design Research Project, with the hopes of exploring the various technologies in use by the magazine industry and what movements the trends were indicating. Note, as this was written in 2008, some of the points mentioned are either outdated or no longer valid.

Continue Reading

Digital Design Project: theboar.ca

.........................................................

My independent digital design project (DAC 400) completed as part of my Digital Arts Communication specialization explored the push by magazines into the online and technology spaces. The goal of the project was to explore viable technologies to use as a platform for developing an online presence for The Boar, an arts and literary magazine produced by and for the students in the Faculty of Arts at the University of Waterloo. I explored the traditional online website format but looked further by designing a prototype of an up-and-coming Flash-based technology known as the “digital edition.” This “new technology” is being adopted industry-wide like wildfire (see Issuu, Scribd, Zinio, etc.). It takes a traditional PDF and converts it into an interactive magazine-like object on a webpage that can be used and manipulated much like a physical magazine. My prototype (although not entirely functional) took a step further and explored the possibilities of creating greater ties between a magazine’s website and their digital edition via a synchronization of comments, bookmarking, and other social networking type tools.

As supplementary materials, I have attached 3 documents that I completed as part of my project:

  • Technology Research: exploration of various technologies in use by the magazine industry and what movements the trends were indicating.
  • Strategy, Scope & Structure: Documentation outlining requirements for the online presence and drill down into specifics, as well as a high-level architectural diagram.
  • Final Analysis: Analysis of the end result of my project, including rationale for technical and design choices as well as possible enhancements for the future.

Also included is a somewhat-working version of the digital edition prototype.

The website in its current state, which has deviated slightly from the original design, can be found here: http://theboar.ca

Continue Reading

HackIt: How to add Smart Playlists to your iPod

.........................................................

Holy Smart Playlists, Batman!

Holy Smart Playlists, Batman!

One of the greatest things about iTunes is the Smart Playlists feature. One of the worst things about iTunes is figuring out how to do things.

One thing I always had difficulty with was figuring out how to create Smart Playlists for the music on my iPod. Sure, I could create Smart Playlists and sync them directly with my iPod, but sometimes that ends up throwing in music I don’t want. And when you’re dealing with limited storage capacity, you have to be ruthless about what gets on your iPod.

So, I looked everywhere, but didn’t really have much luck (not even through Apple’s Support site). After many hours of fussing, I finally hit jackpot and figured out how. Detailed instructions after the jump.

Note: for this trick to work, you need your iPod set up for automatic sync to a playlist.

Continue Reading

Movember!

.........................................................

Movember

I proudly support moustaches (and fighting prostate cancer)!

Continue Reading

User Interface Design: CanTeach Volunteer Handbook

.........................................................

The final result of the group project for class, DAC 300 (Special Topics in Digital Design: User Interfaces). We created a Volunteer Handbook for CanTeach International, a Waterloo-based organization that sends volunteers to Central America to assist Teachers in schools.

The aim of the project was to design, prototype and test an electronic handbook to be used by volunteers new to the CanTeach program. The expectation was for volunteers to use the handbook throughout all phases of their journey (before, during, and after) as a learning and information gathering tool. The handbook was also to act as an electronic scrapbook of sorts, with tools for volunteers to capture their experiences in text.

The final prototype is below along with various supplementary materials related to the project.

CanTeach Volunteer Handbook (~3MB file; requires TK3 Reader)


Note: Since the prototype requires TK3Reader to be installed, I have included sample screenshots of the eBook as well.

eBook - Intro PageeBook - Intro Page eBook - Table of Contents eBook - Chapter Title Page eBook - Internal Content Page


Tools used: TK3 Author, Adobe Photoshop


Supplementary Materials:

Architecture diagrams
CanTeach eBook - Architecture (initial draft)
Initial Draft


CanTeach eBook - Architecture
Final Architecture

Strategy and Scope Document: http://www.scribd.com/full/3088149?access_key=key-2exzroa8srabm4b2nl5d

Presentation: http://www.scribd.com/full/3088089?access_key=key-1ibct2pwtngup105sysb

Continue Reading

Web Application: KiwiShake

.........................................................

KiwiShake was a prototype Facebook application. The idea was to provide users with the ability to create eCards that could be customized with photos, videos, etc.

I programmed the interface of the application, which involved lots of JavaScript and some AJAX work.

See a somewhat functioning prototype here: http://digitalize.ca/media/kiwi/kiwi.html


Tools used: JavaScript, Aptana IDE, YouTube API, various JavaScript libraries

Continue Reading

Notepad Design for New Faculty

.........................................................

Notepad - Back Page

The above was the final design created by me for the project that I worked on during my first work term. The objective was to create effective resource materials for new faculty at the University of Waterloo. After multiple informational and design interviews with various new faculty members, the result of the project was a personalized stationary pad (design seen above), coupled with an online resource guide.


Tools used: Adobe Photoshop

Continue Reading

Newspaper (Layout) Design

.........................................................

Imprint - Sports Section - 2006-07-14 Opinion Section - 2007-07-27 Imprint - Opinion Section - 2007-05-18-1

For full (readable) versions of these and more, please visit: http://www.scribd.com/groups/view/803-my-layout-designs


Tools used: Adobe InDesign

Continue Reading

Promotional Materials

.........................................................

Laurel Centre - Overview Document Laurel Centre - Lecture Series Poster Whiteout Promotional Poster


Tools used: Adobe Photoshop, Adobe InDesign

Continue Reading

Bill Gates @ the University of Waterloo

.........................................................

Bill GatesBill Gates

These photos were taken for Imprint during Bill Gates’ visit to the University of Waterloo in October 2005.


Tools used: Nikon D1H

Continue Reading

Imprint Online – Web Publishing System

.........................................................

Imprint Publishing

What do you get when you marry the Adobe Scripting Engine with the magic of XML Parsing? Well, one thing you can come out with is a web publishing system that automates the process of publishing the online version of a weekly newspaper.

This is exactly what I did for Imprint. Online publishing for Imprint was always seen as a chore and took forever to do. I searched for a solution, but could not find anything substantial. So it was time to hack something together.

Using the powerful Adobe Scripting Engine and some cleverly crafted JavaScript, I was able to turn an (almost) semantically dead laid out newspaper page (in Adobe InDesign) into a meaningful XML file. (I have to note that some user input was involved; the Web Editor had to appropriately label related Text Boxes within InDesign to associate story elements together). This XML file could then be pumped into a customer online administration component for the Mambo CMS, that would parse through the XML and create the appropriate database entries and automagically publish the newspaper online (I should also note here, that some user input was involved; Users were walked through the list of articles extracted from the XML file and had to indicate the Section and Category each belonged to). Goodbye copy-pasting!

Clever, no?


Tools used: JavaScript, Adobe Scripting Engine, Adobe InDesign, XML, PHP, MySQL, DOMIT XML Parser, Mambo, and hours of rigorous testing

Continue Reading

Imprint – Wiki Project

.........................................................

Imprint Wiki

Imprint, the University of Waterloo’s official student newspaper, faces an interesting HR challenge every 4 months. A new editorial is selected at the start of every school term and volunteers come and the years pass by. Given the high turnover of its staff and the need to attract fresh, new faces to the organization, providing adequate training can be a challenge.

I initiated the Imprint Wiki project with the editor-in-chief at the time to act as a living resource that volunteers would update on an ongoing basis with training and best practices information.


Tools used: PmWiki, some sweet Linux servers, volunteer-power

Continue Reading

stallwallpoetry.com

.........................................................

stallwallpoetry.com

Falling under the category of “Interesting (and peculiar) Blogs”, stallwallpoetry.com aims to preserve and provide an appreciation for the under-appreciated art of bathroom graffiti. I created the template for the blog, incorporating various plug-ins such YAPB and GeoPress to take advantage of this blog’s unique offering.


Tools used: Aptana IDE, Wordpress, YAPB plugin, GeoPress plugin, etc.

Continue Reading

Feds Elections @ University of Waterloo

.........................................................

Renjie Butalid & Jeff Henry

“Jeff Henry discusses the coming hard work with fellow Feds executive Renjie Butalid in the wake of vice-president internal Sai Kit Lo’s resignation.” (details here)

3rd place winner in Campus Photography at the Canadian Community Newspapers Association Better Newspaper Competition 2008


Tools used: Nikon D1H

Continue Reading

Concert Photography @ various locations

.........................................................

The Junction @ Polar JamRock \'n\' RollFinal Fantasy @ Grad HouseFinal Fantasy @ Grad HouseBrass Munk @ Polar Jam


Tools used: Nikon D1H, Sony Cybershot

Continue Reading

Varsity Football @ University of Waterloo

.........................................................

Here Come the WarriorsWarriors Stand Tough


Tools used: Nikon D1H

Continue Reading

UW tests TV offered through residence internet

.........................................................

Originally published in Imprint (October 26, 2007, Volume 30, Issue 15)


“The timing is right … what better place to be than [Waterloo]?”

Pushing into unchartered waters is no easy task, though.

Despite the many challenges in the horizon, Sean Van Koughnett, director of UW Graphics, has high hopes for the project he has been charged with leading. The Media & Mobility Network Project (MMNP) is the University of Waterloo’s foray into the transformation of media and communications in the university environment, the first project of its kind in Canada.

In an age where Facebook, Google, cell phones and other digital technologies are as much a part of a student’s life as basic necessities, UW wants to push the envelope, as the cliché goes, and further connect our already digital lives. The multi-tiered project hopes to explore various technological enhancements to student life.

A pilot study is currently underway to test the feasibility of Internet Protocol Television (IPTV) in residence. Currently, seven senior staff from ResNet — UW’s in-residence, student-powered answer to the Geek Squad — have Freewire TV, an IPTV software, activated in their rooms which enables them to view 11 channels on their computers.

Read the full story


Tools used: pen, paper, laptop, coffee

Continue Reading

Silenced Voices speak out on Sri Lanka

.........................................................

Originally published in Imprint (September 1, 2006, Volume 29, Issue 8)

Honourable Mention in Student News Category at the Ontario Community Newspapers Association Better Newspaper Awards 2007


Their voices were anything but silenced as the eight speakers took to the podium at “Silenced Voices,” a forum held August 29 at the University of Toronto to speak out against the human rights violations faced by the Tamil population in Sri Lanka.

The forum was held in the in wake of recent arrests of alleged LTTE supporters in Canada and the U.S. and the ceasefire break in Sri Lanka. It was a joint partnership between the Student Administrative Council (SAC) at the University of Toronto and the Tamil Youth Organization (TYO) held to get a better understanding of the human rights issues currently taking place in Sri Lanka, said Jennifer Hassum, SAC president and moderator of the forum.

The panel of speakers had representation from various groups, including three individuals who had seen or suffered through the violations firsthand.

Dr. Joseph Chandrakanthan, professor of bioethics at the University of Toronto, recounted memories of his time as a priest in Jaffna in Sri Lanka and the atrocities he witnessed before fleeing to Canada with thousands of other refugees during the ‘90s as the civil war between the Sri Lankan government and the Tamil rebels raged on.

“I do not stand before you as an expert on human rights but someone who has seen the human rights violations,” he said. His last act as priest in Jaffna, he shared with the audience, had been blessing the only remaining body parts of a friend’s brother who had been killed during the fighting.

Read the full story


Tools used: pen, paper, laptop, coffee

Continue Reading

Adobe InDesign script: createMyXML

.........................................................

This script generates an xml file (.xml) from an indesign document (.indd)

It was written largely to streamline the web publishing process at Imprint and is a major component of the Web Publishing system that I developed.

Find it here: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1252518

Details:
Two files are required:
* createMyXML.jsx
* createMyXML.map

Extract the the two into your InDesign scripts folder and follow the instructions below:

* Open the createMyXML.map file in a text editor
* Follow the instructions in the file and add your Paragraph Styles and associated xml tags
* Open your InDesign document
* Assign each story (i.e. all textboxes relating to a story) in the document a unique scripting label (Window->Automation->Scripting Label)
* Run the script
* The script will tag the content accordingly based on the Paragraph Styles used for content

Notes:
* The script will only tag textboxes
* Multiple pages are supported
* To avoid being prompted for the map file every time, open the createMyXML.jsx file in a text editor, browse down till you see /** —-EDIT—- */ and enter the location of the map file
* I have only tested this on Windows with InDesign CS2 (theoretically, it should work on Mac and CS as well)

The script is licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)


Tools used: JavaScript, Adobe Scripting Engine, Adobe InDesign

Continue Reading

Adobe Photoshop script: optimizeMyImages

.........................................................

This script resizes, formats and saves a batch of images from the selected folder to the JPEG format to a specified folder.

Description

The images are proportionally resized to either the maximum width or maximum height (depending on which is greater). If an image is smaller the the maximum width and height, it is not resized. (The max width and max height are set as constants in the script)

The images are converted to RGB.

The images are saved as medium-high quality JPEGs. If the image is already a JPEG, it is not converted. If the image is not a JPEG, it is saved as a JPEG.

The images are closed.

Requirements

  • The MAX_WIDTH and MAX_HEIGHT constants are set in the script

Limitations

PDFs are not supported

Issues

  • TIFs and PSDs may sometimes throw a save dialog at you. In this case, you’re forced to save a copy of the image, as cancelling the save dialog breaks the script execution.

Planned changes

  • If possible, disable prompts and dialogs (such as Save As)
  • Initial prompt upon running the script which gives user options to select max width, max height and colour mode options

Download

optimizeMyImages.jsx


Tools used: JavaScript, Adobe Scripting Engine, Adobe Photoshop

Continue Reading

Imprint Archives

.........................................................

Imprint Archiving

In conjunction with the 50 years of campus journalism celebration at the University of Waterloo, Imprint took made a push to make available online, all 50 years worth of its archives. I took the lead on this as I managing the Imprint website at the time.

We received scanned copies of all the archives in PDF format. To incorporate the archives into our existing system, and to make them easy to browse through, we needed certain pieces of information, such as the volume, issue number, etc. The files were all named with a certain convention and contained all the required pieces except for a key component: the date. Getting the date would be hard; there was no easy solution other than simply opening each PDF file and recording the date manually. The downside to this was that 50 years worth of archives meant that a lot of PDF files needed to be sifted through.

Given the access to a healthy and willing volunteer base, I decided to use “community” power to streamline the process. I set up a quick PHP script that extracted volume and issue information from the file name, and on top of that, threw a quick streamlined interface that asked the user to enter the date information for the PDF file presented. With volunteers working at the task in their spare time, we managed to codify 50 years worth of archives (1,000+ issues in less than a week), whereas, my going at it alone would have taken easily over a month.

Take a walk down history lane here: Imprint Archives

Update (2008-06-04): I recently upgraded the archives to make use of the Scribd API to generate on-the-fly “iPaper” versions of PDFs in the archives. The main benefits of this are savings in bandwidth usage (since some of the PDFs are ~100MB) and a faster, enriched user experience.


Tools used: Healthy and willing volunteers, PHP, MySQL, Regular Expressions

Continue Reading

Imprint Online

.........................................................

Imprint Online Imprint Online Administration
After several years in the online game, Imprint, the University of Waterloo’s official student newspaper, decided that it needed a fresh new website to adapt to the changing trends in the Internet news industry.

I modified the core code of the Mambo content management system to meet the unique needs of a newspaper’s online counterpart, such as having an issue-based publishing system, among others. This involved modifications to both front- and back-end code+interfaces. Beyond this, I investigated add-ons provide additional functionality such as a commenting system and integrated those into the website. If add-ons were not readily available or were not up-to-standard in terms of quality, I wrote them from scratch. A great example is the PDF Archive.


Tools used: Mambo CMS, lots and lots of coffee (for all the late nights spent analyzing and writing code)

Continue Reading

Commercial: iPod + iTunes – Transform Life

.........................................................

Spoof iPod commercial.

Done for class (DAC 200: Designing Digital Sound & Video), mostly to test out how well we could pull off the “green-screen” effect using household materials.

Direction, sound and video editing, and some special effects done by me.


Tools used: Sony Handicam, Adobe Premiere Pro, numerous yards of neon blue cloth, lawnmower, broom, etc.


Supplementary Materials:
Analysis Paper

Continue Reading

Demonstrational Video: Effects Reel

.........................................................

Project for class (DAC200: Designing Digital Sound & Video)

Shows off a couple of neat effects.

Direction, sound and video editing done by me.


Tools used: Sony Handicam, Adobe Premiere Pro, Mustard (not recommended for face)


Supplementary Materials:
Analysis Paper

Continue Reading

Short film: Snapshots

.........................................................

Short film done for class (DAC 200: Designing Digital Sound & Video).

Script, direction, sound and video editing done by me.


Tools used: Sony Handicam, Adobe Premiere Pro, old Polaroids, real live couple, on-set locations, etc.


Supplementary materials:

Treatment

Script

Continue Reading

Justin Trudeau @ the University of Waterloo

.........................................................

Justin TrudeauJustin TrudeauJustin Trudeau

These photos were taken for Imprint during Justin Trudeau’s visit to the University of Waterloo in Winter 2007.


Tools used: Nikon D1H

Continue Reading

Search this Site


[]