Tag Archives: magazine style

How to create a wordpress magazine theme using Twenty Ten – Part 4

This is part three of a short series outlining how to tweak a wordpress template to get some magazine style functionality. Part onePart Two and Part three are available here.

In part three of this short series we looked at adding a second loop to our edited index page to get round the problem of our Featured Post being repeated on the front page. In this final part I’ll look at adding a thumbnail and styling up the page.

Image thumbnails

Over the years, theme designers magazine themes have come up with many weird and wonderful ways of getting thumbnail images on front pages. But it’s only recently that WordPress developers added solid support.

One of the things I wanted to do with this series is to avoid too much tweaking of files. So I’m going to be relying on some of the core features for wordpress to get thumbnails on the page rather than fancy tricks. So beefore we get back in to editing the template code to display thumbnails there are few things we need to check.

Media settings

When you add an image to a blog post you are given the option to add it as a thumbnail, medium, large or original size. We are going to be using the standard function to to get a thumbnail (you may remember it from part 1) and it uses the same shorthand to get an image

<?php the_post_thumbnail('thumbnail'); ?>

The sizes for each these are set in the Media section of the settings tab.

The image size options

So our edited front-page is going to be based on these sizes. If you want any other sizes for your page you should set them here first. The downside of working this way is that this will impact on the sizes of images placed in your blog posts -that’s the trade off of keeping things simple.

Adding a featured image.

Version 2.9 of WordPress included a new post thumbnail option which allowed you to define an image to display “as the representative image for a Post or Page. The display of this images is up to the theme. This is especially useful for “magazine-style” themes where each post has an image.” The feature was renamed “featured image” in wordpress 3.0 – I’m guessing to avoid confusion with thumbnails. Whatever it’s called it’s ideal for our front page.

Adding a featured image

When you write a post you should see a panel called Featured Image. Clicking the Add featured image link opens up a standard image browser. You simply find the image you want to use and click the Use as Featured Image link and you’re done.

So before we go on, add a featured image to the post in your Featured Story category.

Adding the thumbnail to the template

Now that we have set up the Featured image we can edit our template file and get an image on our frontpage.

Open up the Main Index Template file and add the following and edit the first loop so it looks like this:

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php 	the_title(); ?></a></h2>

<?php the_post_thumbnail('medium'); ?>

<?php the_excerpt();?>

We’ve added the post_thumbnail function and called the medium sized image (300×300). The result should be something like:

Our medium thumbnail

Now do the same with the second loop.

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php 	the_title(); ?></a></h2>

<?php the_post_thumbnail('thumbnail'); ?>

<?php the_excerpt(); ?>

We’ve called the same function but specified the thumbnail image. The results should be something like this (don’t forget you need to add a featured image to your other posts)

Thumbnails added to each loop

And that’s it.

Adding some style.

Technically we are done. All the elements we want are on the page. But it’s not looking as good as it could be. We need to add some styling information and make some amendments to the stylesheet file.

I’m not going to go in to a big write up of CSS here (try the excellent W3Schools for a basic intro) but if you’re interested in tweaking wordpress templates it’s one of those areas you’ll be spending a lot of time with.

For now, its enough that when dealing with stylesheets, we need to keep our eye open for two things; divs and classes.

Divs

If you look at the Main Index template file, you’ll see the following lines

<div id="container">
			<div id="content" role="main">
......
		</div><!-- #content -->
		</div><!-- #container -->

The div tag is an html element that doesn’t actually display anything by default, it defines a section of the page. When it comes to look and feel, the key part is the id . This ‘connects’ the div to display instructions defined in the stylesheet. The style definition for container is:

#container {
	float: left;
	margin: 0 -240px 0 0;
	width: 100%;
}

Anything that sits between the div tags will be effected by this definition.

Classes

One restriction of ID’s is that you can only use them once on a page. So if you have a lot of elements on a page that you want to style you have to use a class. Remember the html we used for our post title:

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( 		esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

The first part of that is:

<h2 class="entry-title">

That means we take the standard H2 formatting and add some custom styling.

#content .entry-title {
	color: #000;
	font-size: 21px;
	font-weight: bold;
	line-height: 1.3em;
	margin-bottom: 0;
}

This says, any time the class entry-title (denoted by the full-stop) is referenced inside the content div (denoted by the # symbol) apply the following styling.

Image Alignment

The first thing to sort out is the alignment of the images. I’m going to cheat a little here and pick up the standard style call for images.

Change the post_thumbnail function call in the first loop to the following :

<?php the_post_thumbnail('medium',array("class" => "alignleft")); ?>

The post thumbnail function allows you to stack extra information in parameters that can be ‘added’ to the code as it’s generated. We have stuffed a reference to a style called alignleft. If you call up the Stylesheet file in the theme editor you can find the definiton of that style (you may have to search for while)

#content .alignleft,
#content img.alignleft {
	display: inline;
	float: left;
	margin-right: 24px;
	margin-top: 4px;
}

This is very similar to our post title example above but this time there is also a reference to the image tag (img).

To finish up we can add the same class to the thumbnail call in the second loop:
Change the post_thumbnail function call in the first loop to the following :

<?php the_post_thumbnail('thumbnail',array("class" => "alignleft")); ?>

Boxing in the featured story

To make my featured story stand out I’m going to wrap it in a grey box. To start with I’m going to use a DIV to define that extent of the box.

<div id="content" role="main">
			<div id="FeaturedStory">
...the rest of the loop....

<?php the_excerpt();?>
<?php endwhile; ?>
			
			</div><!-- #FeaturedStory -->

I’ve added a new DIV tag with an id called FeaturedStory and closed the div after the end of the loop.

If you update the file and looked at the page you should see nothing new. Remember DIV tags don’t show up till you style them.

Open the Stylesheet file in the editor window and scroll all the way down to the bottom. Add the following:

#FeaturedStory {
	background: #f7f7f7;
	color: #222;
	margin-bottom: 18px;
	padding: 1.5em;
	height: 350px;
}

This does the following:

  • Changes the background colour to grey
  • Changes the text colour to a dark grey
  • Pads the bottom of the box with 18 pixels of space
  • Pads the all the way round with 1.5 em of space
  • Sets the height of the box to 350pixels

Save the file and look at the results. You’ll see a box around the featured content.

Conclusion

That’s pretty much it. We’ve pulled in a featured post and thumbnail to go with it. Then we added a second loop to pull in the rest of the posts without duplicating our featured post on the page and added a thumbnail to them. Then we styled the results to align the thumbnail and wrap the featured post in a box to make it stand out.

Along the way we’ve touched on PHP, functions, variables and stylesheets. All of which are play a big part in theme development. But we have done it all with the minimum of alteration to the core theme files.

Some issues

This method is not without its issues. Editing the raw files like this is risky if you forget to back things up. There is also the risk that if the theme is updates by wordpress (as it is from time to time) then your customization will be deleted. But the exercise has been more about some of the basic concepts than a robust solution.

So I hope you found it useful and it made sense. Here’s the finished Main index template file:

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query. 
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

		<div id="container">
			<div id="content" role="main">
			<div id="FeaturedStory">

<?php  

			/* This is the new loop to display a featured story.
			 * It creates a variable and then loads all the posts that match the query.
			 */

$my_query = new WP_Query('category_name=Featured Story&showposts=1');


			/* Now it loops through the results and displays the content.
			 */

while ($my_query->have_posts()) : $my_query->the_post(); 
$do_not_duplicate = $post->ID;

			/* We load the Page ID in to a variable to check for duplicates later on
			 * Then it displays the title as a working link with formatting to 
			 * match the Twenty Ten template.
			 * Then we display the excerpt.
			 * Then we finish the loop with the endwhile statement
			 */
?>

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php 	the_title(); ?></a></h2>
<?php the_post_thumbnail('medium',array("class" => "alignleft")); ?>
<?php the_excerpt();?>
<?php endwhile; ?>
			
			</div><!-- #FeaturedStory -->

 <?php 
 
			 /* This is the second loop that replaces the standard loop
			  * It uses the standard loop function calls
			 */
 
 
 if (have_posts()) : while (have_posts()) : the_post();


if( $post->ID == $do_not_duplicate ) continue; 
update_post_caches($posts); 

 			/* This line gets the post ID and checks it agains our duplicate variable
 			 * If it matches it does nothing. If it's different we display the content
			 */

?>

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php 	the_title(); ?></a></h2>
<?php the_post_thumbnail('thumbnail',array("class" => "alignleft")); ?>
<?php the_excerpt(); ?>
<?php endwhile; endif; ?>


			<?php
			/* Run the loop to output the posts.
			 * If you want to overload this in a child theme then include a file
			 * called loop-index.php and that will be used instead.
			 */
			 //get_template_part( 'loop', 'index' );
			?>
			</div><!-- #content -->
		</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Don’t forget, you need to update the Stylesheet file as well.

Questions, comments etc always welcome

How to create a wordpress magazine theme using Twenty Ten – Part 2

This is part two of a short series outlining how to tweak a wordpress template to get some magazine style functionality. Part one is available here.

The copy to clipboard option

Note: If you want to copy code directly from this tutorial roll you mouse over the top, right-hand corner of the code and a little window will pop up with a copy code function.

In the previous part of this tutorial we set ourselves up to experiment with the Twenty Ten Template. So at this point you should have

  • A working installation of the wordpress.org (version 3 or above)
  • The Twenty Ten theme set as the active theme
  • A number of posts sorted in to three categories – News, Sport and Featured Article
  • The permissions for the Twenty Ten theme folder set to 666

The next step is to take a look at the files we are going to edit.

The Main Index template

If you switch to Appearance > Editor and click the Main Index Template link on the right.

You should see the following in the editor window.

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query. 
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

		<div id="container">
			<div id="content" role="main">

			<?php
			/* Run the loop to output the posts.
			 * If you want to overload this in a child theme then include a file
			 * called loop-index.php and that will be used instead.
			 */
			 get_template_part( 'loop', 'index' );
			?>
			</div><!-- #content -->
		</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

We start with some comments. Notice that and see where the PHP starts and ends and you should be able to spot a few function calls. These essentially piece the page together bit by bit. For example…

get_header();

…calls the first part of the webpage including all the HTML needed to set the page up and display the blog title and navigation. The only function that might not be immediately obvious is:

 get_template_part( 'loop', 'index' );

This function calls a template file called loop (loop.php) which contains all the information needed to get and display the list of posts on the front page. It also tells the function that this request has come from the index(homepage).

You can take a look at the loop.php template by opening it in the editor – pretty scary. But the loop is key to the way WordPress works.

What is the loop

Here’s what WordPress say about the loop:

The Loop is used by WordPress to display each of your posts. Using The Loop, WordPress processes each of the posts to be displayed on the current page and formats them according to how they match specified criteria within The Loop tags. Any HTML or PHP code placed in the Loop will be repeated on each post. When WordPress documentation states “This tag must be within The Loop”, such as for specific Template Tag or plugins, the tag will be repeated for each post.

Just to put that in to context, a standard front page would use the loop to :

  1. Get the last 10 posts in the wordpress database, sorted in date order
  2. For each of each post, get the headline, content and other related content and create the HTML to display it
  3. Repeats that process until all ten posts are done.

This might sound complicated but it’s actually got a lot simpler in WordPress 3.0. In earlier versions the loop would be part of the index page. Instead of the relatively simple file above, you would have all the loop content in there as well. This meant a lot more to pick through to sort out a page. You could argue that it’s just shifted the complex stuff to another file. But as we’ll see, it does make life easy for us.

The bottom line is that getting a grip on the loop is the key to tweaking a template. So let’s have a go.

Backing-up

Make sure you have the Main Index Template file loaded in to the editor

  • Copy all the content
  • Open your text editor and paste the content in to a new document.

This is your back up of the file. If anything goes wrong, you can just copy and paste the original file content back. I would advise that you do this at regular intervals. Just copy and paste in to the file and you’ll have a big file with each iteration of the file.

Adding another loop

Now that we are backed up we can edit a file. When working I tend to have two tabs open so I can switch between the backend, where I’m editing, and the front end to see the results.

So, in the backend make sure your in the editor and your looking at the Main Index Template file .

Just after:

<div id="content" role="main">

Add the following:

<?php  
$my_query = new WP_Query('category_name=Featured Story&showposts=1');
while ($my_query->have_posts()) : $my_query->the_post(); 
?>

<h2><?php the_title(); ?></h2>

<?php endwhile; ?>

Click the Update file button to save the changes.

The new loop content

The result should be that the title for the most recent post in the Featured Story category appears at the top of the page with the original list of posts below. It won’t work like a link, that comes next.

$my_query = new WP_Query('category_name=Featured Story&showposts=1');

The first line defines a variable or temporary store for information called $my_query (In PHP variables always start with the $ sign). The ‘value’ of that variable is the result of a new database query which uses the WP_Query function to ask for 1 post from the Featured Story category. By asking for one, you’ll get the latest one.

while ($my_query->have_posts()) : $my_query->the_post(); 

The second line starts a loop. It says that while our variable has content (posts) spit out the content of the post so we can do something with it. In this case we display the title:

<h2><?php the_title(); ?></h2>

Notice the mix of PHP and HTML here. The H2 tag formats the title but its the function the_title() that gets the content. The last bit…

<?php endwhile; ?>

…ends the loop and lets wordpress get on with the rest of the page.

Because we stipulated one post in the query the loop only goes round once. You could try adding more posts to the Featured Story category and adjusting the showposts value to see how it handles more than one post.

Dealing with errors

oops, you've missed something

When you bash around with PHP you will eventually come across an message like this when you look at your page. Don’t panic! All it means is that you’ve missed a bracket or other element in the code. Juts go back and check through. The error message even gives you a clue to what and where you made the mistake.

Adding more content

We can pull in more content from the post using some simple template tags.

Add the following after the_title() code:

<?php the_excerpt(); ?>

So the the bit you’ve added should resemble

<?php  
$my_query = new WP_Query('category_name=Featured Story&showposts=1');
while ($my_query->have_posts()) : $my_query->the_post(); 
?>

<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<?php endwhile; ?>
The added excerpt

Update the file and have a look at the results. You should get the title with a short excerpt and a continue reading link. Check out the wordpress codex entry for the_excerpt() function to see what’s going on.

It’s that simple!

Making the title in to a link

The last part for today is to get the title to work as a link. Here’s the basic code:

<h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2>

I’ve wrapped the the_title() function in a link. But instead of putting a website address on the href= bit I have called another function the_permalink() which returns a direct link to the story.

This will work but it isn’t really complete. To fit in with the template (and well written html) it needs some more information. To make sure it follows the same format as the template I’m going to cheat here and pull in some code from the standard loop (cut and paste from the loop.php file):

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php 	the_title(); ?></a></h2>

If you look hard enough you can still see the the_title() function buried in there and the link. The rest is mix of HTML to make a link and some functions to call various bits of content. I won’t go in to them here but I can be sure that it will produce a link that will fit in with the rest of the template.

The formatted title

Conclusions

By adding another loop at the start of the index page we are able to control what which posts are displayed. Using template tags means we can pick which bits of the post we display. The simple nature of the new WordPress 3.0 main index template means we don’t have huge amounts of code to wade through and if we panic we can simply delete the stuff we have added and the original template is intact.

We still have some issues of styling and we also want to add some thumbnails to our posts. But if you look at the list of posts on the front page you will notice we have another problem – the featured post we called in our new loop is repeated in the original loop content. So quite a few things to sort out.

So tomorrow we will look at how we can replace the old loop all together and how to avoid that duplication. Then, in the final part we’ll look at how we can add the thumbnail and style the content to improve the look and feel. For now, heres the complete file we are left with (with comments added by me) :

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query. 
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

		<div id="container">
			<div id="content" role="main">

<?php  

			/* This is the new loop to display a featured story.
			 * It creates a variable and then loads all the posts that match the query.
			 */

$my_query = new WP_Query('category_name=Featured Story&showposts=1');

			/* Now it loops through the results and displays the content.
			 */

while ($my_query->have_posts()) : $my_query->the_post(); 

			/* Then it displays the title as a working link with formatting to 
			 * match the Twenty Ten template.
			 * Then we display the excerpt.
			 * Then we finish the loop with the endwhile statement
			 */
?>

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php 	the_title(); ?></a></h2>
<?php the_excerpt();?>
<?php endwhile; ?>

			<?php
			/* Run the loop to output the posts.
			 * If you want to overload this in a child theme then include a file
			 * called loop-index.php and that will be used instead.
			 */
			 get_template_part( 'loop', 'index' );
			?>
			</div><!-- #content -->
		</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>


As usual, comments and corrections always welcome.

How to create a wordpress magazine theme using Twenty Ten – Part 1

This is part one of a short series outlining how to tweak a wordpress template to get some magazine style functionality. Part two is live!

I’m in the process of updating installations of wordpress for our students to use. In one sense it’s a stop gap measure as we are in the process of commissioning a more “industrial strength” system for them. But even with a new system in place I think we will still leave some courses the option of going the wordpress route. The magazine students for example, love the flexibility (and low level of tech) that design templates offer. It doesn’t seem to have done them any harm in terms of nominations.

When it comes to design, finding a wordpress template you like is half the battle, there are thousands out there. As more people use wordpress to get publications online, magazine style templates have become a popular search and a big growth area for premium template developers.

It’s tempting to pay for a template you like – nothing wrong with that. But it’s not as complicated as you think to get something up and running, out of the box, with very little tinkering. Especially if you build on existing templates. So I thought it would be useful to look at how easy it would be modify the standard Twentyten theme in to something with some magazine functionality.

Hacking around like this is how I learnt a lot of stuff about wordpress and it’s also a way to get your feet wet with a programming language. In this case PHP

To play along with this you’ll need:

  • Your own installation of the latest version of the wordpress.org software (as I write this it’s 3.0.1). Sorry wordpress.com won’t do.If you have webspace and your thinking of adding wordpress you could do worse than check out the wordpress codex entry on installing wordpress. Some hosts will offer automated installation of wordpress – very useful.
  • A text editor. Even word will do.

That’s it.

The design

The adapted Twenty Ten Theme

This is a screenshot of what we are going to end up with. It has a front page that has a featured post at the top and sections underneath for each category. You’ll also notice that I’ve tinkered around with the header to remove the big image. OK, it’s not going to win any design awards but this is more about exploring the concepts.

Normally you’d plan this kind of thing on paper first. You’d also work on the code in a development environment. An installation of WordPress that only runs on your machine, not the web.

If you’re feeling really brave you can set one up. Here are few resources

I’m going to assume that we dive straight in and edit the template live! I know, bad, bad, bad. All I’m going to say is do so at your own risk.

A word on programming and PHP

WordPress is written in a programming language called PHP.  This isn’t a programming tutorial (I’m not going to explain the basics of programming), but there are a couple of important things to know.

Spotting PHP

You may already be familiar with HTML. You can spot it in the raw code for a webpage because it is contained in pointy – brackets.

<h2>Anything here will appear as a heading two</h2>

In a similar way, you can spot PHP in the raw code for a webpage because it is always between  <?php …. ?>. Here’s an example:

<?php the_title(); ?>

But if you look at the source for this webpage in your browser you will only see HTML. Why don’t we see the PHP?

PHP is a server side language. That means the webserver looks at the page and processes any PHP it finds before it sends you the page. When we use PHP as part of wordpress themes we are using it to generate HTML.

Functions

When programmers write code they will always look for ways to avoid repetitive jobs. Rather than write the same code every time, they write a function. This is a set of instructions that can be called when needed.  The example of PHP above is a function:

<?php the_title(); ?>

Whenever we want to show the title of post we call the function the_title() and the server runs the code needed to get all the right information. The semi-colon is also important. Here’s another example:

<?php the_post_thumbnail('thumbnail'); ?>

This time it’s a function to show a thumbnail for a post. But there is also some content in the brackets. This is a parameter or extra information that the function might need. When the server runs the function to get the post thumbnail it tells the function it wants the thumbnail sized thumbnail. I know, sounds like repetition. We could also say:

<?php the_post_thumbnail('medium'); ?>

That says ‘get the thumbnail but make it medium sized’. In case you were interested, the thumbnail and medium sizes are defined in the media settings of your blog. But more on that later.

There are hundreds of these functions in wordpress. Some are specific to templates, like the examples above, known as template tags. Others do the heavy lifting of making the blog work. We’ll be scratching the surface of the template functions and how they work here but I thought it was worth a little intro.

So we are going to be looking at a little PHP to call some functions to help us modify the TwentyTen template. Hopefully, now, that might statement might make a bit more sense.

How wordpress themes work.

You can get a really good overview of the way themes work from the wordpress codex and plenty of other websites around. A google search for wordpress theme tutorials should give you plenty of options. But let’s break it down in to a few simple ideas.

A wordpress theme is split in to parts:

  • the content you want in a structured form
  • instructions on the way you want it to look.

This information is held in a number of different files.  These are stored in a folder, one for each theme, in the WP_content/themes folder of your wordpress installation. The more complex the theme, the more files there tend to be.

In a basic theme, for example, you will have a file called single.php. That’s the content and structure part. This is a mixture of HTML and PHP. But the way it looks, the colour and style of text, position on the page etc is controlled by a file called style.css. This is a cascading style sheet file.

The Twentyten theme we are going to edit, has 18 content and structure files and four style sheet files. We wont be using all of these for this tutorial. We are only interested in two.

  • Main Index Template (index.php)
  • Stylesheet (style.css)

Accessing template files

There are several ways we can get at these files:

Any of those will do. But I’m going to work through on the assumption you are using the built in editor.

First thing to do is check you have the TwentyTen theme activated by going to Appearance >Themes. It should show Twenty Ten as the current theme. Then click through to the editor panel (Appearance > Editor).

The Theme editor

You’ll see a list of the 18 template files down the right-hand side and an editor window. By default this displays the Visual Editor Stylesheet (editor-style.css). All  you need to do is find and click Main Index Template or Stylesheet on the right to load up the files we will be working with.

Permission to edit.

When you look at the bottom of the editor window you may see a warning: – You need to make this file writeable before you can save your changes

You need to set the permissions on the theme folder!

This could be the biggest stumbling block of the process. But if you are serious about having a go at theme development, even tweaking like this, it’s worth getting your head round.

To remove the error message you need to set the permissions for the Twenty Ten folder to be 666.

Does that make no sense? You could try:

If you set the permissions correctly, the message should be replaced by a big Update File button.

You're ready to start editing!

Some final preparation

From this point I’m going to assume that you have a working installation of wordpress up and running. But before we experiment with the theme we need to have some content to work with. So if your blog doesn’t have posts yet you need to add a few posts to work with. You could do this manually using the lipsum.com, a lorem-ipsum generator and some liberal cut and paste for content. There are also a number of random content generator plugins available. For this exercise I used demo data creator.

We will also need to create some categories and assign the posts across the categories. I’ve used the following for this demo:

  • News
  • Sport
  • Featured Story

Once you have done that we are ready for Part 2 tomorrow, where we will start to edit the front page to get that magazine look.

As always, feedback and suggestions always welcome