http://codex.wordpress.org/Stepping_Into_Templates
Template files are the building blocks of your WordPress site.
At the very minimum, a WordPress Theme consists of two files:
style.css
index.php
The index.php template file is very flexible. It can be used to include all references to the header, sidebar, footer, content, categories, archives, search, error, and any other page created in WordPress.
Most basic structure
HEADER
CONTENT
FOOTER
footer.php
header.php
sidebar.php
1
2
3
| <?php get_sidebar(); ?>
<?php get_footer(); ?> |
More typical / More Complex Structure
HEADER
CONTENT
SIDEBAR
FOOTER
1
| <?php get_sidebar(); ?> |
http://codex.wordpress.org/Theme_Development
http://codex.wordpress.org/Templates
THE Loop
1
2
3
4
5
| <?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<!-- do stuff ... -->
<?php endwhile; ?>
<?php endif; ?> |
http://codex.wordpress.org/The_Loop
http://codex.wordpress.org/The_Loop_in_Action
http://wp.tutsplus.com/tutorials/theme-development/a-beginners-guide-to-the-wordpress-loop/
LET’S CREATE A THEME…
http://www.siteground.com/tutorials/wordpress/wordpress_create_theme.htm
THEME STYLESHEET
http://codex.wordpress.org/Theme_Development
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| /*
Theme Name: Twenty Ten
Theme URI: http://wordpress.org/
Description: The 2010 default theme for WordPress.
Author: wordpressdotorg
Author URI: http://wordpress.org/
Version: 1.0
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)
License:
License URI:
General comments (optional).
*/ |
wordpress generated classes
http://codex.wordpress.org/CSS
http://codex.wordpress.org/Template_Hierarchy
Custom Page Templates
1
2
3
4
5
| <?php
/*
Template Name: Snarfer
*/
?> |
FUNCTIONS
http://codex.wordpress.org/Theme_Development#Functions_File
Adding Featured Image support
1
| add_theme_support( 'post-thumbnails' ); |
http://codex.wordpress.org/Post_Thumbnails
Recent Comments