The Twenty Twelve for WordPress.

props drewstrojny, lancewillett.

also props corvannoorloos, jeffsebring, kobenland, iandstewart, mfields,
mtdesign, op12no2, philiparthurmoore, sixhours, mamaduka.

see #19978.



git-svn-id: https://develop.svn.wordpress.org/trunk@21261 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-07-12 04:20:46 +00:00
parent 86d82ac795
commit 4cc47e2034
31 changed files with 3646 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
/**
* The template for displaying 404 pages (Not Found).
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<article id="post-0" class="post error404 no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentytwelve' ); ?></h1>
</header>
<div class="entry-content">
<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentytwelve' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>

View File

@ -0,0 +1,68 @@
<?php
/**
* The template for displaying Archive pages.
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<section id="primary">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<h1 class="archive-title"><?php
if ( is_day() ) {
printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' );
} elseif ( is_month() ) {
printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' );
} elseif ( is_year() ) {
printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' );
} elseif ( is_tag() ) {
printf( __( 'Tag Archives: %s', 'twentytwelve' ), '<span>' . single_tag_title( '', false ) . '</span>' );
// Show an optional tag description
$tag_description = tag_description();
if ( $tag_description )
echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
} elseif ( is_category() ) {
printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' );
// Show an optional category description
$category_description = category_description();
if ( $category_description )
echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
} else {
_e( 'Blog Archives', 'twentytwelve' );
}
?></h1>
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
/* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
twentytwelve_content_nav( 'nav-below' );
?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,70 @@
<?php
/**
* The template for displaying Author Archive pages.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<section id="primary">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<?php
/* Queue the first post, that way we know
* what author we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
the_post();
?>
<header class="page-header">
<h1 class="archive-title author"><?php printf( __( 'Author Archives: %s', 'twentytwelve' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
</header>
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
?>
<?php twentytwelve_content_nav( 'nav-above' ); ?>
<?php
// If a user has filled out their description, show a bio on their entries.
if ( get_the_author_meta( 'description' ) ) : ?>
<div id="author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 60 ) ); ?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
<p><?php the_author_meta( 'description' ); ?></p>
</div><!-- #author-description -->
</div><!-- #author-info -->
<?php endif; ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php twentytwelve_content_nav( 'nav-below' ); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,56 @@
<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
* handled by a callback to twentytwelve_comment() which is
* located in the functions.php file.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<?php
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() )
return;
?>
<div id="comments">
<?php // You can start editing here -- including this comment! ?>
<?php if ( have_comments() ) : ?>
<h2 id="comments-title">
<?php
printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
?>
</h2>
<ol class="commentlist">
<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?>
</ol><!-- .commentlist -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-below" role="navigation">
<h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentytwelve' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentytwelve' ) ); ?></div>
</nav>
<?php endif; // check for comment navigation ?>
<?php // If comments are closed and there are comments, let's leave a little note.
elseif ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="nocomments"><?php _e( 'Comments are closed.', 'twentytwelve' ); ?></p>
<?php endif; ?>
<?php comment_form(); ?>
</div><!-- #comments -->

View File

@ -0,0 +1,23 @@
<?php
/**
* The template for displaying posts in the Aside post format
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="aside">
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
</div><!-- .entry-content -->
</div>
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<div class="edit-link">', '</div>' ); ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_date(); ?></a>
</footer><!-- #entry-meta -->
</article><!-- #post -->

View File

@ -0,0 +1,20 @@
<?php
/**
* The template for displaying posts in the Image post format
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<h1><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<h2><?php the_date(); ?></h2>
</footer><!-- #entry-meta -->
</article><!-- #post -->

View File

@ -0,0 +1,21 @@
<?php
/**
* The template for displaying posts in the Link post format
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header><?php _e( 'Link', 'twentytwelve' ); ?></header>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<div class="edit-link">', '</div>' ); ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_date(); ?></a>
</footer><!-- #entry-meta -->
</article><!-- #post -->

View File

@ -0,0 +1,20 @@
<?php
/**
* The template for displaying a "No posts found" message.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->

View File

@ -0,0 +1,23 @@
<?php
/**
* The template used for displaying page content in page.php
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->

View File

@ -0,0 +1,20 @@
<?php
/**
* The template for displaying posts in the Quote post format
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<div class="edit-link">', '</div>' ); ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_date(); ?></a>
</footer><!-- #entry-meta -->
</article><!-- #post -->

View File

@ -0,0 +1,58 @@
<?php
/**
* The default template for displaying content. Used for both single and index/archive/search.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_sticky() ) : ?>
<div class="featured-post">
<?php _e( 'Featured post', 'twentytwelve' ); ?>
</div>
<?php endif; ?>
<header class="entry-header">
<?php the_post_thumbnail(); ?>
<?php if ( is_single() ) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php else : ?>
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php endif; // is_single() ?>
<?php if ( comments_open() ) : ?>
<div class="comments-link">
<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
</div><!-- .comments-link -->
<?php endif; // comments_open() ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php twentytwelve_entry_meta(); ?>
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
<div id="author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
<p><?php the_author_meta( 'description' ); ?></p>
<div id="author-link">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?>
</a>
</div><!-- #author-link -->
</div><!-- #author-description -->
</div><!-- #author-info -->
<?php endif; ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->

View File

@ -0,0 +1,23 @@
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the id=main div and all content after
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
</div><!-- #main -->
<footer id="colophon" role="contentinfo">
<div class="site-info">
<?php do_action( 'twentytwelve_credits' ); ?>
<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentytwelve' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentytwelve' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'twentytwelve' ), 'WordPress' ); ?></a>
</div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>

View File

@ -0,0 +1,23 @@
<?php
/**
* Template Name: Full-width page, no sidebar
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>

View File

@ -0,0 +1,326 @@
<?php
/**
* Twenty Twelve functions and definitions
*
* Sets up the theme and provides some helper functions. Some helper functions
* are used in the theme as custom template tags. Others are attached to action and
* filter hooks in WordPress to change core functionality.
*
* The first function, twentytwelve_setup(), sets up the theme by registering support
* for various features in WordPress, such as a custom background and a navigation menu.
*
* When using a child theme (see http://codex.wordpress.org/Theme_Development and
* http://codex.wordpress.org/Child_Themes), you can override certain functions
* (those wrapped in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before the parent
* theme's file, so the child theme functions would be used.
*
* Functions that are not pluggable (not wrapped in function_exists()) are instead attached
* to a filter or action hook.
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 584;
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
* and backgrounds, and post formats.
* @uses register_nav_menu() To add support for navigation menus.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_setup() {
global $twentytwelve_options;
/**
* Make Twenty Twelve available for translation.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Twenty Twelve, use a find and replace
* to change 'twentytwelve' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'twentytwelve', get_template_directory() . '/languages' );
// Load up our theme options page and related code.
require( get_template_directory() . '/inc/theme-options.php' );
$twentytwelve_options = new Twenty_Twelve_Options();
// You can define support for an editor stylesheet here; Twenty Twelve doesn't have a default one.
// Then, create a CSS file called editor-style.css and place it in your theme directory.
add_editor_style();
// Add default posts and comments RSS feed links to <head>.
add_theme_support( 'automatic-feed-links' );
// Add support for a variety of post formats
add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
// Add support for custom background.
add_theme_support( 'custom-background' );
// Add custom image size for featured image use, displayed on "standard" posts.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop
}
add_action( 'after_setup_theme', 'twentytwelve_setup' );
/**
* Add support for a custom header image.
*/
require( get_template_directory() . '/inc/custom-header.php' );
/**
* Enqueue scripts and styles for front-end.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_scripts_styles() {
global $twentytwelve_options;
/**
* Add JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/**
* JavaScript for handling navigation menus and the resized
* styles for small screen sizes.
*/
wp_enqueue_script( 'navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130320', true );
/**
* Load special font CSS file.
* Depends on Theme Options setting.
*/
$options = $twentytwelve_options->get_theme_options();
if ( $options['enable_fonts'] )
wp_enqueue_style( 'fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' );
/**
* Load our main CSS file.
*/
wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
/**
* Load HTML5 shiv for older IE version support for HTML5 elements.
* Ideally, should load after main CSS file.
*
* See html5.js link in header.php.
*
* TODO depends on IE dependency being in core for JS enqueuing
* before we can move here properly: see http://core.trac.wordpress.org/ticket/16024
*/
}
add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'twentytwelve_page_menu_args' );
/**
* Register our single widget area.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'twentytwelve' ),
'id' => 'sidebar-1',
'description' => __( 'Appears on posts and pages except the optional Homepage template, which uses its own set of widgets', 'twentytwelve' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Homepage Widgets', 'twentytwelve' ),
'id' => 'sidebar-home',
'description' => __( 'Appears when using the optional homepage template with a page set as Static Front Page', 'twentytwelve' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'twentytwelve_widgets_init' );
if ( ! function_exists( 'twentytwelve_content_nav' ) ) :
/**
* Display navigation to next/previous pages when applicable
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_content_nav( $nav_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
<nav id="<?php echo $nav_id; ?>" role="navigation">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
<div class="nav-previous alignleft"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div>
</nav><!-- #nav-above -->
<?php endif;
}
endif;
if ( ! function_exists( 'twentytwelve_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own twentytwelve_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
<?php
break;
default :
// Proceed with normal comments.
global $post;
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment">
<header class="comment-meta comment-author vcard">
<?php
echo get_avatar( $comment, 44 );
printf( '<cite class="fn">%1$s %2$s</cite>',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Post author', 'twentytwelve' ) . '</span>' : ''
);
printf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
);
?>
</header>
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></p>
<?php endif; ?>
<section class="comment post-content">
<?php comment_text(); ?>
<?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<p class="edit-link">', '</p>' ); ?>
</section>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span>&darr;</span>', 'twentytwelve' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</article><!-- #comment-## -->
<?php
break;
endswitch; // end comment_type check
}
endif;
if ( ! function_exists( 'twentytwelve_entry_meta' ) ) :
/**
* Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
*
* Create your own twentytwelve_entry_meta() to override in a child theme.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_entry_meta() {
// Translators: used between list items, there is a space after the comma.
$categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );
// Translators: used between list items, there is a space after the comma.
$tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) );
$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ),
get_the_author()
);
// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
if ( '' != $tag_list ) {
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'twentytwelve' );
} elseif ( '' != $categories_list ) {
$utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'twentytwelve' );
} else {
$utility_text = __( 'This entry was posted on %3$s by %4$s.', 'twentytwelve' );
}
printf(
$utility_text,
$categories_list,
$tag_list,
$date,
$author
);
}
endif;
/**
* Extends the default WordPress body class to denote a full-width layout.
*
* Used in two cases: no active widgets in sidebar, and full-width page template.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_body_class( $classes ) {
if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width' ) )
$classes[] = 'full-width';
return $classes;
}
add_filter( 'body_class', 'twentytwelve_body_class' );
/**
* Adjust $content width for full-width and single image attachment templates.
*/
function twentytwelve_content_width() {
if ( is_page_template( 'full-width-page.php' ) || is_attachment() ) {
global $content_width;
$content_width = 960;
}
}
add_action( 'template_redirect', 'twentytwelve_content_width' );

View File

@ -0,0 +1,45 @@
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?php wp_title( '|', true, 'right' ); ?><?php echo bloginfo( 'name' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed">
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav class="site-navigation main-navigation" role="navigation">
<h3 class="assistive-text"><?php _e( 'Show navigation', 'twentytwelve' ); ?></h3>
<div class="skip-link assistive-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a></div>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav>
<?php $header_image = get_header_image();
if ( ! empty( $header_image ) ) : ?>
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
<?php endif; ?>
</header><!-- #masthead -->
<div id="main">

View File

@ -0,0 +1,37 @@
<?php
/**
* Template Name: Homepage
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<div class="home-top">
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<section class="home-content<?php echo ( has_post_thumbnail() ) ? ' thumbnail' : ''; ?>">
<div class="entry-content">
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<?php the_content(); ?>
</div><!-- .entry-content -->
</section>
<?php endwhile; // end of the loop. ?>
</div><!-- .home-top -->
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar( 'home' ); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,102 @@
<?php
/**
* The template for displaying image attachments.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary" class="image-attachment">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
<footer class="entry-meta">
<?php
$metadata = wp_get_attachment_metadata();
printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s" pubdate>%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>', 'twentytwelve' ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( wp_get_attachment_url() ),
$metadata['width'],
$metadata['height'],
esc_url( get_permalink( $post->post_parent ) ),
esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ),
get_the_title( $post->post_parent )
);
?>
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
<nav id="image-navigation" role="navigation">
<span class="previous-image"><?php previous_image_link( false, __( '&larr; Previous', 'twentytwelve' ) ); ?></span>
<span class="next-image"><?php next_image_link( false, __( 'Next &rarr;', 'twentytwelve' ) ); ?></span>
</nav><!-- #image-navigation -->
</header><!-- .entry-header -->
<div class="entry-content">
<div class="entry-attachment">
<div class="attachment">
<?php
/**
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
*/
$attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
foreach ( $attachments as $k => $attachment ) {
if ( $attachment->ID == $post->ID )
break;
}
$k++;
// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) {
if ( isset( $attachments[ $k ] ) )
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
else
// or get the URL of the first image attachment
$next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
} else {
// or, if there's only 1 image, get the URL of the image
$next_attachment_url = wp_get_attachment_url();
}
?>
<a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
$attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) );
echo wp_get_attachment_image( $post->ID, $attachment_size );
?></a>
<?php if ( ! empty( $post->post_excerpt ) ) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div>
<?php endif; ?>
</div><!-- .attachment -->
</div><!-- .entry-attachment -->
<div class="entry-description">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-description -->
</div><!-- .entry-content -->
</article><!-- #post -->
<?php comments_template(); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>

View File

@ -0,0 +1,190 @@
<?php
/**
* Implement an optional custom header for Twenty Twelve.
* http://codex.wordpress.org/Custom_Headers
*
* @package Twenty_Twelve
* @since Twenty Twelve 1.0
*/
/**
* Back compat support for get_custom_header().
* New since WordPress version 3.4.
*
* To provide backward compatibility with previous versions, we
* will define our own version of this function.
*
* @todo Should this go into core instead?
*
* @return stdClass All properties represent attributes of the current header image.
*
* @package Twenty_Twelve
* @since Twenty Twelve 1.0
*/
if ( ! function_exists( 'get_custom_header' ) ) {
function get_custom_header() {
return (object) array(
'url' => get_header_image(),
'thumbnail_url' => get_header_image(),
'width' => HEADER_IMAGE_WIDTH,
'height' => HEADER_IMAGE_HEIGHT
);
}
}
/**
* Setup the WordPress core custom header arguments and settings.
*
* Use add_theme_support() to register support for WordPress 3.4+
* as well as provide backward compatibility for previous versions.
*
* Use feature detection of wp_get_theme() which was introduced
* in WordPress 3.4.
*
* @uses twentytwelve_header_style()
* @uses twentytwelve_admin_header_style()
* @uses twentytwelve_admin_header_image()
*
* @package Twenty_Twelve
*/
function twentytwelve_custom_header_setup() {
$args = array(
// Text color and image (empty to use none).
'default-text-color' => '444',
'default-image' => '',
// Set height and width, with a maximum value for the width.
'height' => 250,
'width' => 960,
'max-width' => 2000,
// Support flexible height and width.
'flex-height' => true,
'flex-width' => true,
// Random image rotation off by default.
'random-default' => false,
// Callbacks for styling the header and the admin preview.
'wp-head-callback' => 'twentytwelve_header_style',
'admin-head-callback' => 'twentytwelve_admin_header_style',
'admin-preview-callback' => 'twentytwelve_admin_header_image',
);
// Allow child themes to filter any of these arguments.
$args = apply_filters( 'twentytwelve_custom_header_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-header', $args );
} else {
// Back compat for < 3.4 versions.
define( 'HEADER_TEXTCOLOR', $args['default-text-color'] );
define( 'HEADER_IMAGE', $args['default-image'] );
define( 'HEADER_IMAGE_WIDTH', $args['width'] );
define( 'HEADER_IMAGE_HEIGHT', $args['height'] );
add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] );
}
}
add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );
/**
* Styles the header text displayed on the blog.
*
* get_header_textcolor() options: 444 is default, hide text (returns 'blank'), or any hex value.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_header_style() {
$text_color = get_header_textcolor();
// If no custom options for text are set, let's bail
if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) )
return;
// If we get this far, we have custom styles.
?>
<style type="text/css">
<?php
// Has the text been hidden?
if ( ! display_header_text() ) :
?>
.site-title,
.site-description {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text, use that.
else :
?>
.site-title a,
.site-description {
color: #<?php echo $text_color; ?> !important;
}
<?php endif; ?>
</style>
<?php
}
/**
* Styles the header image displayed on the Appearance > Header admin panel.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_admin_header_style() {
?>
<style type="text/css">
.appearance_page_custom-header #headimg {
border: none;
}
#headimg h1,
#headimg h2 {
line-height: 1.6;
margin: 0;
padding: 0;
}
#headimg h1 {
font-size: 30px;
}
#headimg h1 a {
color: #515151;
text-decoration: none;
}
#headimg h1 a:hover {
color: #21759b;
}
#headimg h2 {
color: #777;
font: normal 13px/1.8 "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
margin-bottom: 24px;
}
#headimg img {
max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px;
}
</style>
<?php
}
/**
* Custom header image markup displayed on the Appearance > Header admin panel.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_admin_header_image() {
?>
<div id="headimg">
<?php
if ( ! display_header_text() )
$style = ' style="display:none;"';
else
$style = ' style="color:#' . get_header_textcolor() . ';"';
?>
<h1><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<h2 id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></h2>
<?php $header_image = get_header_image();
if ( ! empty( $header_image ) ) : ?>
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
<?php endif; ?>
</div>
<?php }

View File

@ -0,0 +1,186 @@
<?php
/**
* Twenty Twelve Theme Options
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
class Twenty_Twelve_Options {
/**
* The option value in the database will be based on get_stylesheet()
* so child themes don't share the parent theme's option value.
*/
var $option_key = 'twentytwelve_theme_options';
/**
* Initialize our options.
*/
var $options = array();
function Twenty_Twelve_Options() {
// Set option key based on get_stylesheet()
if ( 'twentytwelve' != get_stylesheet() )
$this->option_key = get_stylesheet() . '_theme_options';
add_action( 'admin_init', array( $this, 'options_init' ) );
add_action( 'admin_menu', array( $this, 'add_page' ) );
add_action( 'customize_register', array( $this, 'customize_register' ) );
}
/**
* Register the form setting for our options array.
*
* This function is attached to the admin_init action hook.
*
* This call to register_setting() registers a validation callback, validate(),
* which is used when the option is saved, to ensure that our option values are properly
* formatted, and safe.
*/
function options_init() {
// Load our options for use in any method.
$this->options = $this->get_theme_options();
// Register our option group.
register_setting(
'twentytwelve_options', // Options group, see settings_fields() call in render_page()
$this->option_key, // Database option, see get_theme_options()
array( $this, 'validate' ) // The sanitization callback, see validate()
);
// Register our settings field group.
add_settings_section(
'general', // Unique identifier for the settings section
'', // Section title (we don't want one)
'__return_false', // Section callback (we don't want anything)
'theme_options' // Menu slug, used to uniquely identify the page; see add_page()
);
// Register our individual settings fields.
add_settings_field(
'enable_fonts', // Unique identifier for the field for this section
__( 'Enable Web Fonts', 'twentytwelve' ), // Setting field label
array( $this, 'settings_field_enable_fonts' ), // Function that renders the settings field
'theme_options', // Menu slug, used to uniquely identify the page; see add_page()
'general' // Settings section. Same as the first argument in the add_settings_section() above
);
}
/**
* Add our theme options page to the admin menu.
*
* This function is attached to the admin_menu action hook.
*/
function add_page() {
$theme_page = add_theme_page(
__( 'Theme Options', 'twentytwelve' ), // Name of page
__( 'Theme Options', 'twentytwelve' ), // Label in menu
'edit_theme_options', // Capability required
'theme_options', // Menu slug, used to uniquely identify the page
array( $this, 'render_page' ) // Function that renders the options page
);
}
/**
* Returns the default options.
*/
function get_default_theme_options() {
$default_theme_options = array(
'enable_fonts' => false,
);
return apply_filters( 'twentytwelve_default_theme_options', $default_theme_options );
}
/**
* Returns the options array.
*/
function get_theme_options() {
return get_option( $this->option_key, $this->get_default_theme_options() );
}
/**
* Renders the enable fonts checkbox setting field.
*/
function settings_field_enable_fonts() {
$options = $this->options;
?>
<label for="enable-fonts">
<input type="checkbox" name="<?php echo $this->option_key; ?>[enable_fonts]" id="enable-fonts" <?php checked( $options['enable_fonts'] ); ?> />
<?php _e( 'Yes, I&#8217;d like to enable the gorgeous, open-source <em>Open Sans</em> typeface.', 'twentytwelve' ); ?>
</label>
<?php
}
/**
* Returns the options array.
*
* @uses get_current_theme() for back compat, fallback for < 3.4
*/
function render_page() {
?>
<div class="wrap">
<?php screen_icon(); ?>
<?php $theme_name = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_current_theme(); ?>
<h2><?php printf( __( '%s Theme Options', 'twentytwelve' ), $theme_name ); ?></h2>
<?php settings_errors(); ?>
<form method="post" action="options.php">
<?php
settings_fields( 'twentytwelve_options' );
do_settings_sections( 'theme_options' );
submit_button();
?>
</form>
</div>
<?php
}
/**
* Sanitize and validate form input. Accepts an array, return a sanitized array.
*
* @see options_init()
*/
function validate( $input ) {
$output = $defaults = $this->get_default_theme_options();
// The enable fonts checkbox should boolean true or false
if ( ! isset( $input['enable_fonts'] ) )
$input['enable_fonts'] = false;
$output['enable_fonts'] = ( false != $input['enable_fonts'] ? true : false );
return apply_filters( 'twentytwelve_options_validate', $output, $input, $defaults );
}
/**
* Implement Twenty Twelve theme options into Theme Customizer
*
* @param $wp_customize Theme Customizer object
* @return void
*
* @since Twenty Twelve 1.0
*/
function customize_register( $wp_customize ) {
// Enable Web Fonts
$wp_customize->add_section( $this->option_key . '_enable_fonts', array(
'title' => __( 'Fonts', 'twentytwelve' ),
'priority' => 35,
) );
$defaults = $this->get_default_theme_options();
$wp_customize->add_setting( $this->option_key . '[enable_fonts]', array(
'default' => $defaults['enable_fonts'],
'type' => 'option',
'capability' => 'edit_theme_options',
) );
$wp_customize->add_control( $this->option_key . '_enable_fonts', array(
'label' => __( 'Enable Web Fonts', 'twentytwelve' ),
'section' => $this->option_key . '_enable_fonts',
'settings' => $this->option_key . '[enable_fonts]',
'type' => 'checkbox',
) );
}
}

View File

@ -0,0 +1,65 @@
<?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_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php twentytwelve_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<?php if ( current_user_can( 'edit_posts' ) ) :
// Show a different message to a logged-in user who can add posts.
?>
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
</div><!-- .entry-content -->
<?php else :
// Show the default message to everyone else.
?>
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing found', 'twentytwelve' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
<?php endif; // end current_user_can() check ?>
</article><!-- #post-0 -->
<?php endif; // end have_posts() check ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,6 @@
/*! HTML5 Shiv v3.6RC1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");
var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,
b){a||(a=f);if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);

View File

@ -0,0 +1,41 @@
/**
* navigation.js
*
* Handles toggling the navigation menu for small screens.
*/
jQuery( document ).ready( function( $ ) {
var masthead = $( '#masthead' ),
largeWindow = window.matchMedia( 'screen and (min-width: 600px)' ),
timeout = false;
$.fn.smallMenu = function() {
masthead.find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
masthead.find( '.site-navigation h3' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
$( '.menu-toggle' ).off( 'click' ).click( function() {
masthead.find( '.menu' ).slideToggle();
$( this ).toggleClass( 'toggled-on' );
} );
};
// Check viewport width on first load.
if ( ! largeWindow.matches )
$.fn.smallMenu();
// Check viewport width when user resizes the browser window.
$( window ).resize( function() {
if ( false !== timeout )
clearTimeout( timeout );
timeout = setTimeout( function() {
if ( ! largeWindow.matches ) {
$.fn.smallMenu();
} else {
masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
masthead.find( '.site-navigation h3' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
masthead.find( '.menu' ).removeAttr( 'style' );
}
}, 200 );
} );
} );

View File

@ -0,0 +1,351 @@
# Copyright (C) 2012 the WordPress team
# This file is distributed under the GNU General Public License v2 or later.
msgid ""
msgstr ""
"Project-Id-Version: Twenty Twelve .6\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentytwelve\n"
"POT-Creation-Date: 2012-07-05 00:21:16+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#: 404.php:17
msgid "This is somewhat embarrassing, isn&rsquo;t it?"
msgstr ""
#: 404.php:21
msgid ""
"It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps "
"searching can help."
msgstr ""
#: archive.php:23
msgid "Daily Archives: %s"
msgstr ""
#: archive.php:25
msgid "Monthly Archives: %s"
msgstr ""
#: archive.php:25
msgctxt "monthly archives date format"
msgid "F Y"
msgstr ""
#: archive.php:27
msgid "Yearly Archives: %s"
msgstr ""
#: archive.php:27
msgctxt "yearly archives date format"
msgid "Y"
msgstr ""
#: archive.php:29
msgid "Tag Archives: %s"
msgstr ""
#: archive.php:35
msgid "Category Archives: %s"
msgstr ""
#: archive.php:41
msgid "Blog Archives"
msgstr ""
#: author.php:28
msgid "Author Archives: %s"
msgstr ""
#: author.php:49 content.php:40
msgid "About %s"
msgstr ""
#: comments.php:31
msgid "One thought on &ldquo;%2$s&rdquo;"
msgid_plural "%1$s thoughts on &ldquo;%2$s&rdquo;"
msgstr[0] ""
msgstr[1] ""
#: comments.php:42
msgid "Comment navigation"
msgstr ""
#: comments.php:43
msgid "&larr; Older Comments"
msgstr ""
#: comments.php:44
msgid "Newer Comments &rarr;"
msgstr ""
#: comments.php:51
msgid "Comments are closed."
msgstr ""
#: content-aside.php:13 content-aside.php:21 content-image.php:17
#: content-link.php:19 content-quote.php:18 content.php:17
msgid "Permalink to %s"
msgstr ""
#: content-aside.php:15 content-image.php:13 content-link.php:14
#: content-quote.php:13 content.php:27
msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>"
msgstr ""
#: content-aside.php:20 content-link.php:18 content-page.php:21
#: content-quote.php:17 content.php:33 functions.php:242 image.php:35
msgid "Edit"
msgstr ""
#: content-link.php:12
msgid "Link"
msgstr ""
#: content-none.php:13 search.php:34
msgid "Nothing Found"
msgstr ""
#: content-none.php:17
msgid ""
"Apologies, but no results were found. Perhaps searching will help find a "
"related post."
msgstr ""
#: content-page.php:18 content.php:28 image.php:88
msgid "Pages:"
msgstr ""
#: content.php:21
msgid "Leave a reply"
msgstr ""
#: content.php:21
msgid "1 Reply"
msgstr ""
#: content.php:21
msgid "% Replies"
msgstr ""
#: content.php:44
msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>"
msgstr ""
#. #-#-#-#-# twentytwelve.pot (Twenty Twelve .6) #-#-#-#-#
#. Author URI of the plugin/theme
#: footer.php:16
msgid "http://wordpress.org/"
msgstr ""
#: footer.php:16
msgid "Semantic Personal Publishing Platform"
msgstr ""
#: footer.php:16
msgid "Proudly powered by %s"
msgstr ""
#: functions.php:67
msgid "Primary Menu"
msgstr ""
#: functions.php:151
msgid "Main Sidebar"
msgstr ""
#: functions.php:153
msgid ""
"Appears on posts and pages except the optional Homepage template, which uses "
"its own set of widgets"
msgstr ""
#: functions.php:161
msgid "Homepage Widgets"
msgstr ""
#: functions.php:163
msgid ""
"Appears when using the optional homepage template with a page set as Static "
"Front Page"
msgstr ""
#: functions.php:183 single.php:20
msgid "Post navigation"
msgstr ""
#: functions.php:184
msgid "<span class=\"meta-nav\">&larr;</span> Older posts"
msgstr ""
#: functions.php:185
msgid "Newer posts <span class=\"meta-nav\">&rarr;</span>"
msgstr ""
#: functions.php:210
msgid "Pingback:"
msgstr ""
#: functions.php:210
msgid "(Edit)"
msgstr ""
#: functions.php:225
msgid "Post author"
msgstr ""
#. translators: 1: date, 2: time
#: functions.php:231
msgid "%1$s at %2$s"
msgstr ""
#: functions.php:237
msgid "Your comment is awaiting moderation."
msgstr ""
#: functions.php:246
msgid "Reply <span>&darr;</span>"
msgstr ""
#: functions.php:265 functions.php:268
msgid ", "
msgstr ""
#: functions.php:279
msgid "View all posts by %s"
msgstr ""
#: functions.php:285
msgid "This entry was posted in %1$s and tagged %2$s on %3$s by %4$s."
msgstr ""
#: functions.php:287
msgid "This entry was posted in %1$s on %3$s by %4$s."
msgstr ""
#: functions.php:289
msgid "This entry was posted on %3$s by %4$s."
msgstr ""
#: header.php:34
msgid "Show navigation"
msgstr ""
#: header.php:35
msgid "Skip to content"
msgstr ""
#: image.php:24
msgid ""
"<span class=\"meta-prep meta-prep-entry-date\">Published </span> <span class="
"\"entry-date\"><time class=\"entry-date\" datetime=\"%1$s\" pubdate>%2$s</"
"time></span> at <a href=\"%3$s\" title=\"Link to full-size image\">%4$s "
"&times; %5$s</a> in <a href=\"%6$s\" title=\"Return to %7$s\" rel=\"gallery"
"\">%8$s</a>"
msgstr ""
#: image.php:39
msgid "&larr; Previous"
msgstr ""
#: image.php:40
msgid "Next &rarr;"
msgstr ""
#: inc/theme-options.php:63 inc/theme-options.php:180
msgid "Enable Web Fonts"
msgstr ""
#: inc/theme-options.php:77 inc/theme-options.php:78
msgid "Theme Options"
msgstr ""
#: inc/theme-options.php:111
msgid ""
"Yes, I&#8217;d like to enable the gorgeous, open-source <em>Open Sans</em> "
"typeface."
msgstr ""
#: inc/theme-options.php:126
msgid "%s Theme Options"
msgstr ""
#: inc/theme-options.php:167
msgid "Fonts"
msgstr ""
#: index.php:37
msgid "No posts to display"
msgstr ""
#: index.php:41
msgid "Ready to publish your first post? <a href=\"%s\">Get started here</a>."
msgstr ""
#: index.php:48
msgid "Nothing found"
msgstr ""
#: index.php:52
msgid ""
"Apologies, but no results were found for the requested archive. Perhaps "
"searching will help find a related post."
msgstr ""
#: search.php:18
msgid "Search Results for: %s"
msgstr ""
#: search.php:38
msgid ""
"Sorry, but nothing matched your search criteria. Please try again with some "
"different keywords."
msgstr ""
#: single.php:21
msgid "<span class=\"meta-nav\">&larr;</span>"
msgstr ""
#: single.php:22
msgid "<span class=\"meta-nav\">&rarr;</span>"
msgstr ""
#. Theme Name of the plugin/theme
msgid "Twenty Twelve"
msgstr ""
#. Theme URI of the plugin/theme
msgid "http://wordpress.org/extend/themes/twentytwelve"
msgstr ""
#. Description of the plugin/theme
msgid ""
"The 2012 theme for WordPress is a fully responsive theme that looks great on "
"any device. Features include a homepage template with a its own widgets, an "
"optional display font, styling for post formats on both index and single "
"views, and an optional no-sidebar page template. Make it yours with a custom "
"menu, header image, and background."
msgstr ""
#. Author of the plugin/theme
msgid "the WordPress team"
msgstr ""
#. Tags of the plugin/theme
msgid ""
"light, gray, white, one-column, two-columns, right-sidebar, flexible-width, "
"responsive-width, custom-background, custom-header, custom-menu, featured-"
"images, full-width-template, microformats, post-formats, rtl-language-"
"support, sticky-post, theme-options, translation-ready"
msgstr ""
#. Template Name of the plugin/theme
msgid "Full-width page, no sidebar"
msgstr ""
#. Template Name of the plugin/theme
msgid "Homepage"
msgstr ""

View File

@ -0,0 +1,29 @@
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,215 @@
/*
Theme Name: Twenty Twelve
Adding support for language written in a Right To Left (RTL) direction is easy -
it's just a matter of overwriting all the horizontal positioning attributes
of your CSS stylesheet in a separate stylesheet file named rtl.css.
http://codex.wordpress.org/Right_to_Left_Language_Support
*/
caption,
th,
td {
text-align: right;
}
/* =Repeatable patterns
-------------------------------------------------------------- */
/* Buttons */
.menu-toggle,
input#searchsubmit,
li.bypostauthor cite span {
background-image: -khtml-gradient(linear, right top, right bottom, from(#f4f4f4), to(#e6e6e6));
background-image: -webkit-gradient(linear, right top, right bottom, color-stop(0%, #f4f4f4), color-stop(100%, #e6e6e6));
}
.menu-toggle:hover,
input#searchsubmit:hover,
li.bypostauthor cite span:hover {
background-image: -khtml-gradient(linear, right top, right bottom, from(#f9f9f9), to(#ebebeb));
background-image: -webkit-gradient(linear, right top, right bottom, color-stop(0%, #f9f9f9), color-stop(100%, #ebebeb));
}
.menu-toggle:active, .menu-toggle.toggled-on,
input#searchsubmit:active,
input#searchsubmit.toggled-on,
li.bypostauthor cite span:active,
li.bypostauthor cite span.toggled-on {
background-image: -khtml-gradient(linear, right top, right bottom, from(#ebebeb), to(#e1e1e1));
background-image: -webkit-gradient(linear, right top, right bottom, color-stop(0%, #ebebeb), color-stop(100%, #e1e1e1));
}
/* Images */
.alignright {
float: right;
}
.alignleft {
float: left;
}
#content .gallery-columns-4 .gallery-item {
padding-left: 2%;
padding-right: 0;
}
#content .gallery-columns-5 .gallery-item {
padding-left: 2%;
padding-right: 0;
}
/* Navigation */
.nav-previous,
.previous-image {
float: right;
}
.nav-next,
.next-image {
float: left;
text-align: left;
}
/* Author profiles */
#author-avatar {
float: right;
}
#author-description {
float: right;
margin-right: 15px;
margin-right: 1.071428571rem;
margin-left: auto;
}
/* =Basic structure
-------------------------------------------------------------- */
/* Navigation Menu */
nav.main-navigation li {
margin-left: 40px;
margin-left: 2.857142857rem;
margin-right: auto;
}
nav.main-navigation li ul ul {
right: 100%;
left: auto;
}
nav.main-navigation ul li:hover > ul {
border-right: 0;
border-left: none;
}
/* =Basic post styling
-------------------------------------------------------------- */
.entry-content img.alignright {
float: right;
margin: 0 0 0 24px;
}
.entry-content li {
margin: 0 24px 0 0;
}
.entry-content img.alignright {
margin: 12px 0 12px 24px;
}
.entry-content img.alignleft {
margin: 12px 24px 12px 0;
}
.entry-content td {
padding: 6px 0 6px 10px;
}
/* =Aside post styling
-------------------------------------------------------------- */
article.format-aside .aside {
border-right: 22px solid #a8bfe8;
border-left: none;
}
/* =Link post styling
-------------------------------------------------------------- */
article.format-link header {
float: left;
}
article.format-link .entry-content {
float: right;
}
/* =Comment styling
-------------------------------------------------------------- */
#comments article header img {
float: right;
}
#comments article header cite,
#comments article header time {
margin-right: 85px;
margin-right: 6.071428571rem;
margin-left: auto;
}
#comments article header h4 {
left: 0;
background-image: -khtml-gradient(linear, right top, right bottom, from(#009cee), to(#0088d0));
background-image: -webkit-gradient(linear, right top, right bottom, color-stop(0%, #009cee), color-stop(100%, #0088d0));
right: auto;
}
#comments li.bypostauthor cite span {
margin-right: 5px;
margin-right: 0.357142857rem;
background-image: -khtml-gradient(linear, right top, right bottom, from(#4aacd8), to(#21759b));
background-image: -webkit-gradient(linear, right top, right bottom, color-stop(0%, #4aacd8), color-stop(100%, #21759b));
margin-left: auto;
}
/* Comment form */
#respond h3#reply-title #cancel-comment-reply-link {
margin-right: 10px;
margin-right: 0.714285714rem;
margin-left: auto;
}
label ~ span.required {
float: right;
margin: -18px -16px 0 0;
}
/* =Home page template styling
-------------------------------------------------------------- */
.page-template-homepage-php #secondary aside.widget_text img {
float: right;
margin: 8px 0 8px 24px;
}
@media screen and (min-width: 600px) {
.page-template-homepage-php #secondary aside.widget_text img {
float: right;
margin: 8px 0 8px 24px;
}
}
/* =Widget styling
-------------------------------------------------------------- */
.widget ul ul {
margin-right: 12px;
margin-right: 0.857142857rem;
margin-left: auto;
}
.widget_recent_entries .post-date {
margin-right: 12px;
margin-right: 0.857142857rem;
margin-left: auto;
}
#wp-calendar th,
#wp-calendar td,
#wp-calendar caption {
text-align: right;
}
#wp-calendar #next {
padding-left: 24px;
padding-left: 1.714285714rem;
text-align: left;
padding-right: 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -0,0 +1,49 @@
<?php
/**
* The template for displaying Search Results pages.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<section id="primary">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentytwelve' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
</header>
<?php twentytwelve_content_nav( 'nav-above' ); ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php twentytwelve_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentytwelve' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,17 @@
<?php
/**
* The Sidebar containing the homepage widget area.
*
* If no active widgets in this sidebar, it will be hidden completely.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<?php if ( is_active_sidebar( 'sidebar-home' ) ) : ?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-home' ); ?>
</div><!-- #secondary .widget-area -->
<?php endif; ?>

View File

@ -0,0 +1,17 @@
<?php
/**
* The Sidebar containing the main widget area.
*
* If no active widgets in sidebar, hide it completely.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary .widget-area -->
<?php endif; ?>

View File

@ -0,0 +1,37 @@
<?php
/**
* The Template for displaying all single posts.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<nav id="nav-single">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span>', 'twentytwelve' ) . ' %title' ); ?></span>
<span class="nav-next"><?php next_post_link( '%link', '%title ' . __( '<span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></span>
</nav><!-- #nav-single -->
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
comments_template( '', true );
?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

File diff suppressed because it is too large Load Diff