There are some flaws in certain snippets (e.g. the comments-template). Sorry about that. Can still be used as a quick reference.
/*
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).
*/
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<title><?php wp_title(); ?> <?php bloginfo('name'); ?></title>
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo get_stylesheet_uri(); ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo get_stylesheet_directory_uri(); ?>/custom-styles.css" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if(is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); ?>
<?php wp_head(); ?>
</head>
<body>
<!-- ... -->
<?php wp_footer(); ?>
</body>
</html>
<?php if(have_posts()): while(have_posts()): the_post(); ?>
<div <?php post_class(); ?>>
<?php
//Post thumbnails need this in functions.php: `add_theme_support('post-thumbnails');`
if(has_post_thumbnail()) the_post_thumbnail(array(100,100));
?>
<h2 id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" title="Permanent link to <?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
<div class="post-metadata">
<p>Posted on <?php the_time('F jS, Y'); ?> by <?php the_author(); ?> in <?php the_category(', '); ?></p>
<p><?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
<div class="post-content">
<?php the_content('Read the rest of this entry »'); ?>
<?php /* the_excerpt(); */ ?>
</div>
<div class="post-tags">
<?php the_tags(); ?>
</div>
</div>
<?php endwhile; ?>
<div class="post-navigation">
<div><?php posts_nav_link('', 'Next Entries »', ''); ?></div>
<div><?php posts_nav_link('', '', '« Previous Entries'); ?></div>
</div>
<?php else: ?>
<!-- No posts found -->
<?php endif; ?>
<?php
/* Call this before `wp_head` */
wp_enqueue_script('jquery');
?>
<!-- Add custom JavaScript from theme directory -->
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/custom-javascript.js"></script>
<div class="post-author">
<?php echo get_avatar(get_the_author_email(), '96', 'path_to_default'); ?>
<div class="post-author-name"><?php the_author_meta('display_name'); ?></div>
<div class="post-author-description"><?php the_author_meta('user_description'); ?></div>
</div>
<?php
/*
Template Name: Kitten Template
*/
//...
?>
<?php
/* Return an array */
echo '<ul>';
foreach(get_post_meta($post->ID, 'sources', false) as $source) {
echo '<li><a href="'.$source.'">'.$source.'</a></li>';
}
echo '</ul>';
/* Return a string */
echo get_post_meta($post->ID, 'copyrights', true);
//Check "Custom form fields" below for adding custom fields to edit-page
?>
<?php
/* A minimal example, in which a post type "Movie" is created. */
add_action('init', 'register_movie_post_type');
function register_movie_post_type() {
register_post_type('movie',array(
'labels' => array(
'name' => _x('Movies', 'post type general name'),
'singular_name' => _x('Movie', 'post type singular name')
),
'public' => true,
'menu_icon' => get_stylesheet_directory_uri().'img/movie_icon.png'
));
register_taxonomy('genres', array('movie'), array(
'label' => 'Genres',
'singular_label' => 'Genre',
'hierarchical' => true,
'rewrite' => true
));
}
//Check "Custom form fields" below for adding custom fields to edit-page
?>
<?php
/* This code adds a custom input to WP admin, when adding/editing a post */
add_action('admin_init', 'register_copyrights_field');
function register_copyrights_field() {
add_meta_box('copyrights_meta', 'Post Copyrights', 'copyrights_callback', '[post_type]', 'normal', 'low');
}
function copyrights_callback() {
global $post;
$custom = get_post_custom($post->ID);
$old_value = $custom['copyrights'][0];
echo '<label>Post Copyrights:</label> <input name="post_copyrights" value="'.$old_value.'" />';
}
add_action('save_post', 'save_copyrights_meta');
function save_copyrights_meta() {
global $post;
update_post_meta($post->ID, 'copyrights', $_POST['post_copyrights']);
}
?>
<?php
/* Only list-items (no wrapping <ul>) */
wp_list_pages('title_li=');
wp_list_categories('title_li=');
wp_get_archives('type=monthly');
?>