|
|
|
|
|
|
![]() |
#15 |
Oh no, I'm sweating like Roger Ebert
|
Setting Up Your Theme - Part One
For Chasing the Walrus I wanted a very simple, basic theme but I wanted it to be unique and attractive. I chose the moony theme and with a little editing came up with this: Chasing the Walrus.
Note: you don't absolutely need to do any of the things below. Right or wrong, this is simply how I optimize my themes. You can either use what you like or throw it all out a quackery. Now it's time to start editing the templates. The thing to remember from scratch is that some plug-ins require certain things get added into the script in order to make them work but you can't add them until after you enable the plug-in or your theme wont work. A sort of catch-22. So I pre-edit the templates a little and then re-edit them as I get to specifics of certain plug-ins. One of what I feel is a shortcoming of WordPress it that they really don't handle meta-tags well. Specificly, the title, description and keyword tags. The Title Tag When I'm on the index page, I want the blog title to appear but when I'm on a category, I want something like this "category name | blog title" and on a page this "page title | blog title". I can blame this on grandmascrotum since she first pointed it out but the damn >> WP likes to add bugs me as well. Especially since it gets added to the front side of the page title and category name. The little hack I found works wonders for taking this out. You can find the details of the hack if your interested in this thread I then edit the header.php template file like this: Code:
<title><?php if (is_home()) { bloginfo('name'); }else { wp_title(); echo " | "; bloginfo('name'); }?></title> There are four basic page displays with WordPress
I have yet to find a single solution to having unique descriptions (or keywords for that matter) for all of these pages. WordPress Meta Tag Generator does a pretty good job with this for everything but category pages. With them it uses the same defaults it would use for the index page. The thing that the plug-in does do that I haven't figured out how to do using template tags is set custom descriptions for WP pages. For this theme, I'll use a combination of the two....WP template tags and Meta Tag Generator for descriptions. I'll use the Meta Tag Generator for WP pages and template tags for all the rest. This is how I form my meta-description tag for my header file: Code:
<meta name="Description" content="<?php if (is_single()) { echo the_excerpt();} elseif (is_category()) { echo category_description();} else { bloginfo('description');} ?>"/> Category uses the category description field you can define when you create the category. Everything else uses the blog description you set as your tagline. Since I want different descriptions for pages but I don't want duplicate meta tags, I edit out the following line usually found right before </head> Code:
<?php wp_head(); ?> I copy my header template and rename it headpage.php. Delete both the meta description and keyword lines and add Code:
<?php wp_head(); ?> Also, edit the page template file and change Code:
<?php get_header(); ?> Code:
<?php include (TEMPLATEPATH . '/headpage.php'); ?> Keywords Since I rely heavily on Ultimate Tag Warrior, I wait to set this up until I enable the plug-in as well. Other pre-install edits: Let me add that I like to show the full posts on the index and single pages and excerpts on all the rest. To do this I edit category.php, archive.php. Simply find Code:
<?php the_content() ?> Code:
<?php the_excerpt() ?> Last edited by walrus; 2007-05-06 at 04:53 PM.. Reason: its not long enough need to add more |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|