Skip to content

Instantly share code, notes, and snippets.

@trevorturk
Created September 20, 2010 15:04
Show Gist options
  • Save trevorturk/588028 to your computer and use it in GitHub Desktop.
Save trevorturk/588028 to your computer and use it in GitHub Desktop.
Simplest: just about the simplest possible theme for WordPress
<?php if ( $comments ) : ?>
<div id="comments">
<h3>Comments</h3>
<?php wp_list_comments(); ?>
<div class="pagination"><?php paginate_comments_links(); ?></div>
</div><!-- comments -->
<?php endif; ?>
<?php if ( comments_open() || pings_open() ) : ?>
<?php comment_form( 'comment_notes_before=&comment_notes_after=' ); ?>
<?php elseif ( $comments ) : ?>
<div id="respond"><p id="closed">Comments closed</p></div>
<?php endif; ?>
<?php
if ( !isset( $content_width ) ) $content_width = 768;
if ( function_exists( 'add_theme_support' ) ) add_theme_support( 'automatic-feed-links' );
if ( function_exists( 'register_nav_menu' ) ) register_nav_menu( 'menu', 'Menu' );
if ( function_exists('register_sidebar') ) register_sidebar( array(
'name' => __( 'Widgets', 'simplest' ),
'id' => 'widgets',
'before_widget' => '<div class="widget">',
'after_widget' => '</div><!-- widget -->',
'before_title' => '<h4>',
'after_title' => '</h4>') );
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<title><?php bloginfo( 'name' ); ?><?php wp_title( '&mdash;' ); ?></title>
<?php if ( is_singular() && get_option( 'thread_comments') ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="container">
<div id="header">
<h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<p id="description"><?php bloginfo( 'description' ); ?></p>
<?php if ( has_nav_menu( 'menu' ) ) : wp_nav_menu(); else : ?>
<ul><?php wp_list_pages( 'title_li=&depth=-1' ); ?></ul>
<?php endif; ?>
</div><!-- header -->
<div id="content">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div <?php post_class(); ?>>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
<?php if ( !is_singular() && get_the_title() == '' ) : ?>
<a href="<?php the_permalink(); ?>">(more...)</a>
<?php endif; ?>
<?php if ( is_singular() ) : ?>
<div class="pagination"><?php wp_link_pages(); ?></div>
<?php endif; ?>
<div class="clear"> </div>
</div><!-- post_class() -->
<?php if ( is_singular() ) : ?>
<div class="meta">
<p>Posted by <?php the_author_posts_link(); ?>
on <a href="<?php the_permalink(); ?>"><?php the_date(); ?></a>
in <?php the_category( ', ' ); ?><?php the_tags( ', ' ); ?></p>
</div><!-- meta -->
<?php comments_template(); ?>
<?php endif; ?>
<?php endwhile; else: ?>
<div class="hentry"><h2>Sorry, the page you requested cannot be found</h2></div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'widgets' ) ) : ?>
<div class="widgets"><?php dynamic_sidebar( 'widgets' ); ?></div>
<?php endif; ?>
<?php if ( is_singular() || is_404() ) : ?>
<div class="left"><a href="<?php bloginfo( 'url' ); ?>">&laquo; Home page</a></div>
<?php else : ?>
<div class="left"><?php next_posts_link( '&laquo; Older posts' ); ?></div>
<div class="right"><?php previous_posts_link( 'Newer posts &raquo;' ); ?></div>
<?php endif; ?>
<div class="clear"> </div>
</div><!-- content -->
</div><!-- container -->
<?php wp_footer(); ?>
</body>
</html>
/*
Theme Name: Simplest
Description: Just about the simplest possible theme for WordPress: 83 lines of PHP and 75 lines of CSS in 4 files.
Author: Trevor Turk
Author URI: http://trevorturk.com/
Theme URI: http://trevorturk.com/2010/09/20/new-wordpress-theme-simplest/
Version: 1.3
Tags: light, white, one-column
License: GNU General Public License v2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/* http://meyerweb.com/eric/tools/css/reset */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
/* simplest */
p,dl,hr,h1,h2,h3,h4,h5,h6,ol,ul,pre,table,address,fieldset {margin-bottom:1em;}
li {list-style:square; margin:0.5em 0 0 2em;}
dt {margin:1em 0; font-weight:bold;}
dd {margin:0 1em; padding-left:1em; border-left:1px solid #ddd;}
th, td {padding:0.5em; border:1px solid #ddd;}
blockquote {margin:0 1em; padding-left:1em; border-left:1px solid #ddd;}
pre {font-family:monospace; background:#f8f8ff; padding:0.5em; overflow:auto;}
sup, sub {height:0; line-height:1; vertical-align:baseline; position:relative; font-size:10px;}
sup {bottom:1ex;}
sub {top:0.5ex;}
.left {float:left;}
.right {float:right;}
.clear {clear:both;}
body {color:#111;}
a {color:#111;}
p {line-height:1.3em;}
h1 {font-size:1.7em;}
h2 {font-size:1.3em;}
h3 {font-size:1.1em;}
h1 a {text-decoration:none;}
h1 a:hover {text-decoration:underline;}
h1,h2,h3,h4,h5,h6 {clear:both;}
#container {width:768px; margin:2em auto;}
#header #description {margin-top:-1.5em;}
#header li {display:inline; margin:0 0.5em 0 0;}
#content {margin-top:4em;}
.hentry, .meta, #respond {margin-bottom:2em; padding-bottom:1em; border-bottom:1px solid #ddd;}
.hentry h2, .hentry h3, .hentry h4 {margin-top:2em;}
.widgets {margin-bottom:2em; border-bottom:1px solid #ddd;}
.widget {margin-bottom:2em;}
.pagination {text-align:center; margin:2em auto 1em auto;}
.pagination a {padding:3px 8px; border: 1px solid #ddd;}
.alignleft {display:inline; float:left; margin:0 1em 1em 0;}
.alignright {display:inline; float:right; margin:0 0 1em 1em;}
.aligncenter {display:block; margin:1em auto;}
.wp-caption {text-align:center; padding:0.5em; background:#ddd;}
.wp-caption-text, .gallery-caption {font-size:0.7em; margin:3px 0;}
#comments {margin-bottom:2em; border-bottom:1px solid #ddd;}
#comments h3, #respond h3 {margin-bottom:2em;}
#comments li {list-style-type:none; margin:0 0 2em 0;}
#comments .avatar {vertical-align:middle; margin-right:2px; padding:2px; border:1px solid #ddd;}
#comments .comment-author {margin-bottom:1em;}
#comments .comment-author cite {font-weight:bold; font-style:normal; margin-top:1em;}
#comments .comment-meta {margin-bottom:1em;}
#comments .reply a {font-size:0.7em;}
#comments .children {margin:2em;}
#comments .pagination {margin-bottom:2em;}
#respond label {display:block;}
#respond .required {display:none;}
#respond #closed {font-style:italic;}
#comments li.comment #respond {margin:2em;}
#comments li.comment #respond h3 {padding-top:2em; border-top:1px solid #ddd;}
#comments li.comment #respond #cancel-comment-reply-link {font-size:0.7em; margin-left:1em;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment