Skip to content

Commit

Permalink
Coding standards cleanup in twentyten, see #9015. Props sivel
Browse files Browse the repository at this point in the history
git-svn-id: https://develop.svn.wordpress.org/trunk@13720 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
mattmiklic committed Mar 16, 2010
1 parent 1bb04ed commit d504e9c
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 117 deletions.
2 changes: 1 addition & 1 deletion wp-content/themes/twentyten/archive.php
Expand Up @@ -23,4 +23,4 @@
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php get_footer(); ?>
20 changes: 10 additions & 10 deletions wp-content/themes/twentyten/attachment.php
Expand Up @@ -5,23 +5,23 @@

<?php the_post(); ?>

<p class="page-title"><a href="<?php echo get_permalink($post->post_parent); ?>" title="<?php printf( esc_attr__( 'Return to %s', 'twentyten' ), esc_html( get_the_title($post->post_parent), 1 ) ); ?>" rel="gallery">&larr; <?php echo get_the_title($post->post_parent); ?></a></p>
<p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php printf( esc_attr__( 'Return to %s', 'twentyten' ), esc_html( get_the_title( $post->post_parent ), 1 ) ); ?>" rel="gallery">&larr; <?php echo get_the_title( $post->post_parent ); ?></a></p>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><?php the_title(); ?></h2>

<div class="entry-meta">
<?php
printf(__( '<span class="meta-prep meta-prep-author"> By </span> <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', 'twentyten'),
get_author_posts_url( get_the_author_meta('ID') ),
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
get_the_author()
);
?>
<span class="meta-sep"> | </span>
<?php
printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span>', 'twentyten'),
esc_attr(get_the_time()),
esc_attr( get_the_time() ),
get_the_date()
);
?>
Expand All @@ -43,7 +43,7 @@
<a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
<?php endif; ?>
</div>
<div class="entry-caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); ?></div>
<div class="entry-caption"><?php if ( ! empty( $post->post_excerpt ) ) the_excerpt(); ?></div>

<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
<?php wp_link_pages( 'before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>' ); ?>
Expand All @@ -60,21 +60,21 @@
}
printf(
$utility_text,
get_the_category_list(', '),
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute('echo=0'),
the_title_attribute( 'echo=0' ),
get_post_comments_feed_link()
);
?>

<?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?>
<?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyten' ), get_trackback_url() ); ?>
<?php elseif ( !comments_open() && pings_open() ) : // Only trackbacks open ?>
<?php elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open ?>
<?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'twentyten' ), get_trackback_url() ); ?>
<?php elseif ( comments_open() && !pings_open() ) : // Only comments open ?>
<?php elseif ( comments_open() && ! pings_open() ) : // Only comments open ?>
<?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyten' ); ?>
<?php elseif ( !comments_open() && !pings_open() ) : // Comments and trackbacks closed ?>
<?php elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed ?>
<?php _e( 'Both comments and trackbacks are currently closed.', 'twentyten' ); ?>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), "\n\t\t\t\t\t<span class=\"edit-link\">", "</span>" ); ?>
Expand All @@ -87,4 +87,4 @@
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php get_footer(); ?>
12 changes: 6 additions & 6 deletions wp-content/themes/twentyten/author.php
Expand Up @@ -5,16 +5,16 @@

<?php the_post(); ?>

<h1 class="page-title author"><?php printf( __( 'Author Archives: <span class="vcard">%s</span>', 'twentyten' ), "<a class='url fn n' href='" . get_author_posts_url( get_the_author_meta('ID') ) . "' title='" . esc_attr(get_the_author()) . "' rel='me'>" . get_the_author() . "</a>" ); ?></h1>
<h1 class="page-title author"><?php printf( __( 'Author Archives: <span class="vcard">%s</span>', 'twentyten' ), "<a class='url fn n' href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a>" ); ?></h1>

<?php if ( get_the_author_meta('description') ) : // If a user has filled out their decscription show a bio on their entries ?>
<?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their decscription show a bio on their entries ?>
<div id="entry-author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta('user_email'), apply_filters('twentyten_author_bio_avatar_size', 60) ); ?>
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) ); ?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf(__('About %s', 'twentyten'), get_the_author()); ?></h2>
<?php the_author_meta('description'); ?>
<h2><?php printf( __( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>
<?php the_author_meta( 'description' ); ?>
</div><!-- #author-description -->
</div><!-- .entry-author-info -->
<?php endif; ?>
Expand All @@ -27,4 +27,4 @@
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php get_footer(); ?>
6 changes: 3 additions & 3 deletions wp-content/themes/twentyten/category.php
Expand Up @@ -4,14 +4,14 @@
<div id="content">

<h1 class="page-title"><?php
printf(__( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title('', false) . '</span>');
printf( __( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
?></h1>
<?php $categorydesc = category_description(); if ( !empty($categorydesc) ) echo apply_filters( 'archive_meta', '<div class="archive-meta">' . $categorydesc . '</div>' ); ?>
<?php $categorydesc = category_description(); if ( ! empty( $categorydesc ) ) echo apply_filters( 'archive_meta', '<div class="archive-meta">' . $categorydesc . '</div>' ); ?>

<?php get_generic_template( 'loop', 'category' ); ?>

</div><!-- #content -->
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php get_footer(); ?>
20 changes: 10 additions & 10 deletions wp-content/themes/twentyten/comments.php
Expand Up @@ -13,26 +13,26 @@

<?php if ( have_comments() ) : ?>
<h3 id="comments-title"><?php comments_number(
sprintf(__('No Responses to %s', 'twentyten'), '<em>' . get_the_title() . '</em>'),
sprintf(__('One Response to %s', 'twentyten'), '<em>' . get_the_title() . '</em>'),
sprintf(__('%% Responses to %s', 'twentyten'), '<em>' . get_the_title() . '</em>')
sprintf( __( 'No Responses to %s', 'twentyten' ), '<em>' . get_the_title() . '</em>' ),
sprintf( __( 'One Response to %s', 'twentyten' ), '<em>' . get_the_title() . '</em>' ),
sprintf( __( '%% Responses to %s', 'twentyten' ), '<em>' . get_the_title() . '</em>' )
); ?> </h3>

<?php if ( get_comment_pages_count() > 1 ) : // are there comments to navigate through ?>
<div class="navigation">
<div class="nav-previous"><?php previous_comments_link( __('&larr; Older Comments', 'twentyten') ); ?></div>
<div class="nav-next"><?php next_comments_link( __('Newer Comments &rarr;', 'twentyten') ); ?></div>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyten' ) ); ?></div>
</div>
<?php endif; // check for comment navigation ?>

<ol class="commentlist">
<?php wp_list_comments( array('callback' => 'twentyten_comment') ); ?>
<?php wp_list_comments( array( 'callback' => 'twentyten_comment' ) ); ?>
</ol>

<?php if ( get_comment_pages_count() > 1 ) : // are there comments to navigate through ?>
<div class="navigation">
<div class="nav-previous"><?php previous_comments_link( __('&larr; Older Comments', 'twentyten') ); ?></div>
<div class="nav-next"><?php next_comments_link( __('Newer Comments &rarr;', 'twentyten') ); ?></div>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyten' ) ); ?></div>
</div>
<?php endif; // check for comment navigation ?>

Expand All @@ -42,11 +42,11 @@

<?php else : // if comments are closed ?>

<p class="nocomments"><?php _e('Comments are closed.', 'twentyten'); ?></p>
<p class="nocomments"><?php _e( 'Comments are closed.', 'twentyten' ); ?></p>

<?php endif; ?>
<?php endif; ?>

<?php comment_form(); ?>

</div><!-- #comments -->
</div><!-- #comments -->
4 changes: 2 additions & 2 deletions wp-content/themes/twentyten/footer.php
Expand Up @@ -6,11 +6,11 @@
<?php get_sidebar( 'footer' ); ?>

<div id="site-info">
<a href="<?php echo home_url('/') ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
<a href="<?php echo home_url( '/' ) ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
</div>

<div id="site-generator">
<?php printf( __('Proudly powered by <span id="generator-link">%s</span>.', 'twentyten'), '<a href="http://wordpress.org/" title="' . esc_attr__( 'Semantic Personal Publishing Platform', 'twentyten' ) . '" rel="generator">' . __( 'WordPress', 'twentyten' ) . '</a>' ); ?>
<?php printf( __( 'Proudly powered by <span id="generator-link">%s</span>.', 'twentyten' ), '<a href="http://wordpress.org/" title="' . esc_attr__( 'Semantic Personal Publishing Platform', 'twentyten' ) . '" rel="generator">' . __( 'WordPress', 'twentyten' ) . '</a>' ); ?>
</div>

</div><!-- #colophon -->
Expand Down
82 changes: 58 additions & 24 deletions wp-content/themes/twentyten/functions.php
Expand Up @@ -8,23 +8,57 @@
function twentyten_init() {
// Your Changeable header business starts here
// No CSS, just IMG call
define( 'HEADER_TEXTCOLOR', '');
define( 'HEADER_IMAGE', '%s/images/headers/forestfloor.jpg'); // %s is theme dir uri
define( 'HEADER_TEXTCOLOR', '' );
define( 'HEADER_IMAGE', '%s/images/headers/forestfloor.jpg' ); // %s is theme dir uri
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );
define( 'NO_HEADER_TEXT', true );

add_custom_image_header( '', 'twentyten_admin_header_style' );
// and thus ends the changeable header business

register_default_headers( array('berries' => array('url' => '%s/images/headers/berries.jpg', 'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg', 'description' => __('Berries')),
'cherryblossom' => array( 'url' => '%s/images/headers/cherryblossoms.jpg', 'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg', 'description' => __('Cherry Blossoms')),
'concave' => array('url' => '%s/images/headers/concave.jpg', 'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg', 'description' => __('Concave')),
'fern' => array('url' => '%s/images/headers/fern.jpg', 'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg', 'description' => __('Fern')),
'forestfloor' => array('url' => '%s/images/headers/forestfloor.jpg', 'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg', 'description' => __('Forest Floor')),
'inkwell' => array('url' => '%s/images/headers/inkwell.jpg', 'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg', 'description' => __('Ink Well')),
'path' => array('url' => '%s/images/headers/path.jpg', 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg', 'description' => __('Path')),
'sunset' => array('url' => '%s/images/headers/sunset.jpg', 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg', 'description' => __('Sunset')) ) );
register_default_headers( array (
'berries' => array (
'url' => '%s/images/headers/berries.jpg',
'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
'description' => __( 'Berries' )
),
'cherryblossom' => array (
'url' => '%s/images/headers/cherryblossoms.jpg',
'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
'description' => __( 'Cherry Blossoms' )
),
'concave' => array (
'url' => '%s/images/headers/concave.jpg',
'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
'description' => __( 'Concave' )
),
'fern' => array (
'url' => '%s/images/headers/fern.jpg',
'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
'description' => __( 'Fern' )
),
'forestfloor' => array (
'url' => '%s/images/headers/forestfloor.jpg',
'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
'description' => __( 'Forest Floor' )
),
'inkwell' => array (
'url' => '%s/images/headers/inkwell.jpg',
'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
'description' => __( 'Ink Well' )
),
'path' => array (
'url' => '%s/images/headers/path.jpg',
'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
'description' => __( 'Path' )
),
'sunset' => array (
'url' => '%s/images/headers/sunset.jpg',
'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
'description' => __( 'Sunset' )
)
) );

add_custom_background();

Expand Down Expand Up @@ -75,8 +109,8 @@ function twentyten_admin_header_style() {
// Get the page number
if ( ! function_exists( 'twentyten_get_page_number' ) ) :
function twentyten_get_page_number() {
if ( get_query_var('paged') )
return ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');
if ( get_query_var( 'paged' ) )
return ' | ' . __( 'Page ' , 'twentyten' ) . get_query_var( 'paged' );
}
endif;

Expand All @@ -98,7 +132,7 @@ function twentyten_excerpt_length( $length ) {

// Make a nice read more link on excerpts
if ( ! function_exists( 'twentyten_excerpt_more' ) ) :
function twentyten_excerpt_more($more) {
function twentyten_excerpt_more( $more ) {
return '&nbsp;&hellip; <a href="'. get_permalink() . '">' . 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>' . '</a>';
}
endif;
Expand All @@ -121,7 +155,7 @@ function twentyten_comment( $comment, $args, $depth ) {
<br />
<?php endif; ?>

<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ),' ','' ); ?></div>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ),' ','' ); ?></div>

<div class="comment-body"><?php comment_text(); ?></div>

Expand All @@ -147,27 +181,27 @@ function twentyten_remove_gallery_css( $css ) {

if ( ! function_exists( 'twentyten_cat_list' ) ) :
function twentyten_cat_list() {
return twentyten_term_list('category', ', ', __('Posted in %s', 'twentyten'), __('Also posted in %s', 'twentyten') );
return twentyten_term_list( 'category', ', ', __( 'Posted in %s', 'twentyten' ), __( 'Also posted in %s', 'twentyten' ) );
}
endif;

if ( ! function_exists( 'twentyten_tag_list' ) ) :
function twentyten_tag_list() {
return twentyten_term_list('post_tag', ', ', __('Tagged %s', 'twentyten'), __('Also tagged %s', 'twentyten') );
return twentyten_term_list( 'post_tag', ', ', __( 'Tagged %s', 'twentyten' ), __( 'Also tagged %s', 'twentyten' ) );
}
endif;

if ( ! function_exists( 'twentyten_term_list' ) ) :
function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '') {
function twentyten_term_list( $taxonomy, $glue = ', ', $text = '', $also_text = '' ) {
global $wp_query, $post;
$current_term = $wp_query->get_queried_object();
$terms = wp_get_object_terms($post->ID, $taxonomy);
$terms = wp_get_object_terms( $post->ID, $taxonomy );
// If we're viewing a Taxonomy page..
if ( isset($current_term->taxonomy) && $taxonomy == $current_term->taxonomy ) {
if ( isset( $current_term->taxonomy ) && $taxonomy == $current_term->taxonomy ) {
// Remove the term from display.
foreach ( (array)$terms as $key => $term ) {
foreach ( (array) $terms as $key => $term ) {
if ( $term->term_id == $current_term->term_id ) {
unset($terms[$key]);
unset( $terms[$key] );
break;
}
}
Expand All @@ -176,11 +210,11 @@ function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '
}
$tlist = array();
$rel = 'category' == $taxonomy ? 'rel="category"' : 'rel="tag"';
foreach ( (array)$terms as $term ) {
foreach ( (array) $terms as $term ) {
$tlist[] = '<a href="' . get_term_link( $term, $taxonomy ) . '" title="' . esc_attr( sprintf( __( 'View all posts in %s', 'twentyten' ), $term->name ) ) . '" ' . $rel . '>' . $term->name . '</a>';
}
if ( !empty($tlist) )
return sprintf($text, join($glue, $tlist));
if ( ! empty( $tlist ) )
return sprintf( $text, join( $glue, $tlist ) );
return '';
}
endif;
Expand Down

0 comments on commit d504e9c

Please sign in to comment.