Join Chris Coyier for an in-depth discussion in this video Styling the home page, pt. 2, part of WordPress 3: Creating and Editing Custom Themes (2010).
There is just a little bit more of the main content area of our homepage…that needs to be styled.…It's this section here.…So let's get to that.…Let's take a look at the Photoshop file that we are trying to match, and…it's this region here.…So it's this Featured Widgets text and then our list of two widgets here with a…title, description, their image, and this View Product button here.…So that's what we are going to be styling.…Let's take a look at the HTML that covers that area.…
It's in our index.html file here.…I have our whole project opened in TextMate and it starts right here.…It's just this h2 tag of Featured Widgets, and then each of those two widgets is…wrapped in this list with an ID of featured-widgets.…So let's style this h2 tag first.…Now it doesn't have any special IDs associated with it, so let's actually put…the styling for this h2 tag in our style .css file, so that we can re-use it on…other pages if need be.…So all h2 tags in the site are going to look like this.…
It's going to have a color associated with it.…
- 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.