Join Chris Coyier for an in-depth discussion in this video Creating custom category pages, part of WordPress 3: Creating and Editing Custom Themes.
So we just finished upgrading this custom product page template for our design…and that's what we're looking at here, but a page like this is actually going to…live at the bottom of the hierarchy of this site.…There's going to be a couple of levels above it.…This Sprocketizer is going to be in a product category of sprockets, which is…going to be within the top level, which is the store page, and the store is…going to display all the categories.…So, we're going to need a new type of page template in our theme called…Category, and that's going to end up looking like this.…
So, the homepage for the store and it's got this header for Sprockets and then…two products that are under the Sprockets category and then this header for…Sprunklers and this one product that's under the Sprunkler category.…This is what the store homepage looks like, and it's going to share that same template.…If you are just looking at Sprockets, we just see the header for Sprockets and…then just these two products.…So, let's get started by creating that new template in our theme.…
- Building a design in Photoshop
- Converting Photoshop design to HTML and CSS
- Setting up MAMP on Mac and WAMP on Windows
- Moving HTML and CSS into a WordPress theme
- Building navigation
- Using custom fields
- Creating a commenting system
Skill Level Intermediate
Q: What prerequisite skill do I need to be successful in this course?
Q: The index.php file that the author is working with in Chapter 3 doesn't match mine after the "Building a sidebar" movie. It appears to change between the "Building a sidebar" and "Building the navigation" movies. What code am I missing?
A: The author makes some changes off screen between several movies in this title, simply because there is so much material to cover. These changes are provided in the exercise files.
However, if you are following along without the exercise files, you catch up to him by adding the following code to your index.php file, directly after the <?php get_header(); ?> line:
Near the end of the file, just before <?php get_sidebar(); ?>, add a closing div tag, </div>, to complete the div wrapper.
The resulting code will look like so. You may also copy and paste this into a new file and save it as index.php.
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
<?php the_content(); ?>
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted in <?php the_category(', ') ?> |
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php else : ?>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Q: How do I load my custom theme once I have finished?
A: Copy the Custom theme folder to your new WordPress installation and put it in wp-content > themes. Then you can activate the new theme and work with it from there.