Walkthrough for Week 1 Assignment

A lot of people had problems with this assignment so I’m sharing here a walk-through of how it could be done. This assumes you started with the Twenty Ten theme installed.

  • Create a Twenty Ten child theme by creating the folder “wp-content/themes/twentyten-child” and a file style.css with the following inside:
    /*
    Theme Name:     Twenty Ten Child
    Theme URI:      http: //example.com/
    Description:    Child theme for the Twenty Ten theme
    Author:         Your name here
    Author URI:     http: //example.com/about/
    Template:       twentyten
    Version:        0.1.0
    */
    
  • Copy the contents of “wp-content/themes/twentyten/style.css” into that file.
  • Create two post categories “casual” and “weddings”.
  • Add a post for each created category.
  • When you assign a category to a post it will add a CSS class automatically to that post, e.g. category-weddings for category weddings, so what you will need to do to style it differently is create that CSS class in style.css, e.g.:
    .category-weddings
    {
    background-color: #F5FFFA;
    text-align: center;
    }
  • That’s it, your posts in the category weddings will be styled differently.

Here’s an example of the end result:

http://webcraft.morgadinho.org/

2 thoughts on “Walkthrough for Week 1 Assignment

  1. Hi there,

    The thing you have to keep in mind is that some themes (like TwentyTen) automatically generate a class for the categories.

    So if you have a theme that doesn't, you have to manually add the post_class function to the relevant WordPress template files.

    cheers,

    Jo

Comments are closed.