WordPress Theme Design - Rich Media Institute Workshop
-
Upload
brendan-sera-shriar -
Category
Technology
-
view
5.381 -
download
0
description
Transcript of WordPress Theme Design - Rich Media Institute Workshop
WordPress Theme DesignRich Media Institute
Brendan Sera-ShriarBackSpaceStudios.com
What’s a Theme?Seriously, do I really have to answer this…
In this workshop, I will explain the basics of how a WordPress theme works and show you how to convert a static HTML
template into a theme. No PHP skill is required (but learning some will always help), however, you will need Photoshop and
CSS skills to create your own design.
The Basic TemplateWe will be using the ‘Default’ theme as our template for structure.
Take note of the elements (header, post title, search form, navigation, footer, etc.)
index.php
single.php
Let’s take a quick look at theWordPress Theme Architecture
Theme Architecture
The Main page • home.php • index.php
Single Post page • single.php • index.php
WordPress Page • page.php • index.php
Category page • category.php • archive.php • index.php
Theme Architecture
Cont…
Search Result page • search.php • index.php
404 (Not Found) page • 404.php • index.php
The Next Step Create a Photoshop mockup for your new theme or use an existing static
HTML+CSS template.
Photoshop MockupAfter the design is done, you will need to build am HTML+CSS template from your psd file. Make sure to create an index.php, single.php, and page.php file.
For this workship, we will be using the HTML+CSS template ‘Keep It Simple’ from styleshout.com. You can download the theme here
http://www.backspacestudios.com/RMI/kis.zip
Here’s The Template
HTML+CSS
Why Create a Static HTML File First?
Mainly because it will make the development process a lot easier. I usually create a HTML file for every template that I need, test it across all browsers, validate both HTML and CSS markups, then all I have to do is cut & paste the WordPress code. By doing so, I don’t have to worry about HTML or CSS bugs during my theme making process.
A Quick Look At Template StructuresBasic Template Files To generate such a structure within a WordPress Theme, start with an index.php template file in your Theme's directory. This file has two main functions:
1. Include or "call" the other template files 2. Include the WordPress Loop to gather information from the database (posts, pages, categories, etc.)
Most theme structures include three other template files: the header, sidebar, and footer. These must be named header.php, sidebar.php, footer.php. The Template Tags that include them look like this:
<?php get_header(); ?><?php get_sidebar(); ?> <?php get_footer(); ?>
In order to display the posts and pages of your blog (and to customize how they are being displayed), your index.php file should run the WordPress Loop between the header and footer calls.
The WordPress Loop
Understanding The Loop
The Loop is used to display blog posts and it also lets you control what to display.
Basically, The Loop checks if there are posts in your blog, while there are posts,
display it, if no post found, say "Not Found“.
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h2>Not Found</h2>
<?php endif; ?>
The Stylesheet - style.css
The stylesheet - style.css must provide details about the Theme in the form of comments. No two Themes are allowed to have the same details listed in their comment headers, as this will lead to problems in the Theme selection dialog. If you make your own Theme by copying an existing one, make sure you change this information first.
/* Theme Name: name-of-your-theme
Theme URI: the-theme's-homepage
Description: a-brief-description
Author: your-name
Author URI: your-URI
Template: use-this-to-define-a-parent-theme--optional
Version: a-number--optional
*/
Let’s look at the code…
WordPress Page Template
Ok, final example. I will show you how to use Page Template to create an archive
page that will list all posts on your blog (good for sitemap). Copy the archives.php file
from the default theme folder. Delete the unwanted code and you should have
something like this:
<?php /* Template Name: Archives with Content */
?>
<?php get_header(); ?>
<div><h2><?php the_title();?></h2>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
WordPress Page Template
Cont…
Now, login to your admin panel,
write a new page, title it Archives.
On the Page Template dropdown,
select Archives.
Bridging Two Worlds!
FlashPress is an extension to WordPress, which allows Flash designers/developers to use the WordPress engine to communicate with a Flash site. The use of the WordPress CMS in Flash overcomes many obstacles involved with maintaining and updating a Flash site.
The FlashPress development thread is restricted to contributors of this group. If you would like to contribute to this project please contact us at [email protected]
Launching soon http://www.flashpress.ca and http://www.flashpressdevelopers.com
We will be launching FlashPress at FITC Toronto 2009!
FREE PHUG WorkshopsCurrent Scheduled Workshops:
Tiki WikiFBML and Facebook Fan PagesThe Power of TwitterAdvertising for the Social WebCustomizing WP2.7 Admin
We would like to thank some of our sponsors and affiliates:PHUG, Lifecapture Interactive Inc., BackSpaceStudios, Mozilla Firefox, WordPress.org, Drupal.org, FITC ( Flash In The Can ), RMI ( Rich Media Institute ), TikiWiki, Citadel Rock.
If you would like to present or no someone who does we are still taking applications. Please send us anemail at [email protected].
http://workshops.phug.ca
WordCamp Toronto 2009Hosted by PHUG
WordCamp is a conference type of event that focuses squarely on everything WordPress. Everyone from casual end users all the way up to core developers show up to these events. These events are usually highlighted by speeches or keynotes by various people.
http://www.wordcamptoronto.com
Resources
• http://www.backspacestudios.com
• http://www.phug.ca
• http://codex.wordpress.org/Working_with_WordPress#WordPress_Features
• http://codex.wordpress.org/Template_Hierarchy
• http://codex.wordpress.org/Conditional_Tags
• http://codex.wordpress.org/Templates
• http://codex.wordpress.org/Customizing_Your_Sidebar
• http://www.tamba2.org.uk/wordpress/graphicalcss/
• http://www.ndesign-studio.com
• http://www.webdesignerwall.com
• http://bloggingsquared.com
• http://automattic.com
• http://www.blog.spoongraphics.co.uk
• http://www.webappers.com
• http://www.wppotential.com
Thank You
WordPress Theme Design Workshop at RMI
Brendan Sera-Shriar, Director BackSpaceStudios
http://www.backspacestudios.com
Founder of PHUG – Open Source Culture
http://www.phug.ca