I’ve searched long and hard trying to find a way to add the page name to the title tag dynamically to my WordPress blog page when I’m using WordPress as a CMS. I finally found the solution that I was able to understand at ‘Web Designer Wall.’ I changed his code a bit to suit my own needs and thought I’d paste the code here for anyone who may need it (and as a repository for me for future use).
The following PHP code should be placed between your title tags in the header.php file.
< ?php
if (is_home()) {
echo 'News - Pop Stalin Design: Web Design With Standards'; wp_title('');
} elseif (is_404()) {
echo '404 Not Found'; echo ' - '; echo bloginfo('name');
} elseif (is_category()) {
echo 'Categories - '; echo wp_title(''); echo ' - '; echo bloginfo('name');
} elseif (is_search()) {
echo 'Search Results'; echo ' - '; echo bloginfo('name');
} elseif ( is_day() || is_month() || is_year() ) {
echo 'Archives - '; wp_title('');
} else {
echo wp_title(''); echo ' - '; echo bloginfo('name');
}
?>
This code seems overly verbose to me but until I can figure out something more concise, this is what I’ll be using.
A mailing list I subscribe to, Women Designer’s Group, one of the women briefly spoke about using WordPress MU for client development. The MU stands for ‘Multi-User’ and so it struck me as a brilliant idea. I’m thinking about implementing it in the near future since I do so much WordPress theme development work. Hell, it’s what Wordpress.com is powered with.
WordPress MU Features
- Everything WordPress does
- Scaling to tens of millions of pageviews per day.
- Unlimited users and blogs.
- Different permissions on different blogs.
What do you think? Pros, cons; is this a viable solution? I’m not super familiar with the admin side of MU, although I do know that it’s basically WordPress with MU wrapped around it for administration.
While toiling away on a redesign for the business side of my site last night, being the Mac geek that I am, I was listening to my iPod through my Powerbook in iTunes; I know, not necessary information but I just wanted to point out how much of a Mac geek I am. So I’m working on the redesign, okay, I was actually surfing the Net avoiding working on the redesign when Rage Against the Machine came out of my speakers. I of course did the only thing any sane person would do when that happens, I threw up the metal, \m/, and moved my head in time with the beat—by the way, my cats, who think I’m very odd to begin with, are now convinced of my oddity. Anyway, a conversation I had with my aunt in my early twenties came back to me. I recall asking her why she started listening to country music being a child of the sixties and all. She proceeded to tell me when you hit your mid-to-late thirties you start to “outgrow” rock & roll because “it’s too loud.” As if! In a couple of weeks I’ll be hitting my mid-to-late thirties marker and as I’m sure many people do when their birth-day nears, I became introspective.
Of course that introspection made me start thinking about my age and the perception of hip designers. Am I growing too old to be considered hip? Am I like those people, mainly women, you see in their retirement years wearing clothes that look like they were purchased in the Junior’s department (for unknowing folk, that’s teen girls)? Then I began to panic when I thought about all the things that have a shelf-life; canned goods, cereal, candy—hell, even Twinkies have a shelf-life, so, do designers? I have no other tangible skills and I can’t see myself ever working in a factory or retail again but I have to wonder, will it some day come to that? What are your thoughts—do designer’s have a shelf-life and how long before we all reach it?
And for the record, I am not switching to country music any time soon. I listen to the occasional alt/country music but that’s different, it’s hip.
In WordPress sometimes you want a different look for different categories. It’s fairly easy to accomplish with a little coding and creating custom page templates.
Code for Page Template File
The only necessity for using a Page Template is the below code. Just place it at the top of the page template you are creating. A good point of reference to see how a Page Template is handled is by looking at the file ‘archives.php’ in your theme. It’s usually the second ‘Archives’ link in the theme editor for the default WordPress theme.
< ?php
/*
Template Name: Custom Category
*/
?>
Code to Call Unique Templates
The below code should be placed at the top of ‘category.php’.
< ?php
$post = $wp_query- >post;
if ( in_category('3') ) {
include(TEMPLATEPATH . '/cat3.php’);
} elseif ( in_category('4') ) {
include(TEMPLATEPATH . '/cat4.php');
} else {
include(TEMPLATEPATH . '/cat.php');
} ? >
As always you can find out more about creating themes and template tags at the WordPress codex.