Twentyten whitespace cleanup, Wrap functions in function_exists() call to allow child themes to override them. Props sivel. See #9015
git-svn-id: https://develop.svn.wordpress.org/trunk@13157 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8f009529bb
commit
cc6a0a5d41
|
@ -1,8 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Set the content width based on the Theme CSS
|
// Set the content width based on the Theme CSS
|
||||||
$content_width = apply_filters( 'twentyten_content_width', 640 );
|
if ( ! isset( $content_width ) )
|
||||||
|
$content_width = 640;
|
||||||
|
|
||||||
|
if ( ! function_exists( 'twentyten_init' ) ) :
|
||||||
|
function twentyten_init() {
|
||||||
// Your Changeable header business starts here
|
// Your Changeable header business starts here
|
||||||
// No CSS, just IMG call
|
// No CSS, just IMG call
|
||||||
define( 'HEADER_TEXTCOLOR', '');
|
define( 'HEADER_TEXTCOLOR', '');
|
||||||
|
@ -11,20 +14,6 @@ define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 94
|
||||||
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );
|
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );
|
||||||
define( 'NO_HEADER_TEXT', true );
|
define( 'NO_HEADER_TEXT', true );
|
||||||
|
|
||||||
function twentyten_admin_header_style() {
|
|
||||||
?>
|
|
||||||
<style type="text/css">
|
|
||||||
#headimg {
|
|
||||||
height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
|
|
||||||
width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
|
|
||||||
}
|
|
||||||
#headimg h1, #headimg #desc {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
add_custom_image_header( '', 'twentyten_admin_header_style' );
|
add_custom_image_header( '', 'twentyten_admin_header_style' );
|
||||||
// and thus ends the changeable header business
|
// and thus ends the changeable header business
|
||||||
|
|
||||||
|
@ -48,31 +37,64 @@ $locale = get_locale();
|
||||||
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
|
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
|
||||||
if ( is_readable( $locale_file ) )
|
if ( is_readable( $locale_file ) )
|
||||||
require_once( $locale_file );
|
require_once( $locale_file );
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
add_action( 'themes_loaded', 'twentyten_init' );
|
||||||
|
|
||||||
|
if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
|
||||||
|
function twentyten_admin_header_style() {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
#headimg {
|
||||||
|
height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
|
||||||
|
width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
|
||||||
|
}
|
||||||
|
#headimg h1, #headimg #desc {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
// Get the page number
|
// Get the page number
|
||||||
|
if ( ! function_exists( 'twentyten_get_page_number' ) ) :
|
||||||
function twentyten_get_page_number() {
|
function twentyten_get_page_number() {
|
||||||
if ( get_query_var('paged') )
|
if ( get_query_var('paged') )
|
||||||
echo ' | ' . __( 'Page ' , 'twentyten' ) . get_query_var('paged');
|
return ' | ' . __( 'Page ' , 'twentyten') . get_query_var('paged');
|
||||||
}
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
|
// Echo the page number
|
||||||
|
if ( ! function_exists( 'twentyten_the_page_number' ) ) :
|
||||||
|
function twentyten_the_page_number() {
|
||||||
|
echo twentyten_get_page_number();
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
// Control excerpt length
|
// Control excerpt length
|
||||||
function twentyten_new_excerpt_length( $length ) {
|
if ( ! function_exists( 'twentyten_excerpt_length' ) ) :
|
||||||
|
function twentyten_excerpt_length( $length ) {
|
||||||
return 40;
|
return 40;
|
||||||
}
|
}
|
||||||
add_filter( 'excerpt_length', 'twentyten_new_excerpt_length' );
|
endif;
|
||||||
|
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
|
||||||
|
|
||||||
|
|
||||||
// Make a nice read more link on excerpts
|
// Make a nice read more link on excerpts
|
||||||
function twentyten_new_excerpt_more($more) {
|
if ( ! function_exists( 'twentyten_excerpt_more' ) ) :
|
||||||
|
function twentyten_excerpt_more($more) {
|
||||||
return ' … <a href="'. get_permalink() . '">' . 'Continue reading <span class="meta-nav">→</span>' . '</a>';
|
return ' … <a href="'. get_permalink() . '">' . 'Continue reading <span class="meta-nav">→</span>' . '</a>';
|
||||||
}
|
}
|
||||||
add_filter( 'excerpt_more', 'twentyten_new_excerpt_more' );
|
endif;
|
||||||
|
add_filter( 'excerpt_more', 'twentyten_excerpt_more' );
|
||||||
|
|
||||||
|
|
||||||
// Template for comments and pingbacks
|
// Template for comments and pingbacks
|
||||||
function twentyten_list_comment( $comment, $args, $depth ) {
|
if ( ! function_exists( 'twentyten_comment' ) ) :
|
||||||
|
function twentyten_comment( $comment, $args, $depth ) {
|
||||||
$GLOBALS ['comment'] = $comment; ?>
|
$GLOBALS ['comment'] = $comment; ?>
|
||||||
<?php if ( '' == $comment->comment_type ) { ?>
|
<?php if ( '' == $comment->comment_type ) : ?>
|
||||||
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
|
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
|
||||||
<div id="comment-<?php comment_ID(); ?>">
|
<div id="comment-<?php comment_ID(); ?>">
|
||||||
<div class="comment-author vcard">
|
<div class="comment-author vcard">
|
||||||
|
@ -93,14 +115,16 @@ function twentyten_list_comment( $comment, $args, $depth ) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php else : ?>
|
||||||
<li class="post pingback">
|
<li class="post pingback">
|
||||||
<p><?php _e( 'Pingback: ', 'twentyten' ); ?><?php comment_author_link(); ?><?php edit_comment_link ( __('edit', 'twentyten'), ' ', '' ); ?></p>
|
<p><?php _e( 'Pingback: ', 'twentyten' ); ?><?php comment_author_link(); ?><?php edit_comment_link ( __('edit', 'twentyten'), ' ', '' ); ?></p>
|
||||||
<?php }
|
<?php endif;
|
||||||
}
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
// Make the Visual Editor styles match the theme's styles
|
// Make the Visual Editor styles match the theme's styles
|
||||||
function twentyten_my_editor_style( $url ) {
|
if ( ! function_exists( 'twentyten_editor_style' ) ) :
|
||||||
|
function twentyten_editor_style( $url ) {
|
||||||
if ( ! empty( $url ) )
|
if ( ! empty( $url ) )
|
||||||
$url .= ',';
|
$url .= ',';
|
||||||
|
|
||||||
|
@ -109,21 +133,30 @@ function twentyten_my_editor_style( $url ) {
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
add_filter( 'mce_css', 'twentyten_my_editor_style' );
|
endif;
|
||||||
|
add_filter( 'mce_css', 'twentyten_editor_style' );
|
||||||
|
|
||||||
// Remove inline styles on gallery shortcode
|
// Remove inline styles on gallery shortcode
|
||||||
|
if ( ! function_exists( 'twentyten_remove_gallery_css' ) ) :
|
||||||
function twentyten_remove_gallery_css() {
|
function twentyten_remove_gallery_css() {
|
||||||
return "<div class='gallery'>";
|
return "\t\t<div class='gallery'>\n\t\t";
|
||||||
}
|
}
|
||||||
|
endif;
|
||||||
add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
|
add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
|
||||||
|
|
||||||
|
if ( ! function_exists( 'twentyten_cat_list' ) ) :
|
||||||
function 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() {
|
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;
|
global $wp_query, $post;
|
||||||
$current_term = $wp_query->get_queried_object();
|
$current_term = $wp_query->get_queried_object();
|
||||||
|
@ -149,8 +182,10 @@ function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '
|
||||||
return sprintf($text, join($glue, $tlist));
|
return sprintf($text, join($glue, $tlist));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
// Register widgetized areas
|
// Register widgetized areas
|
||||||
|
if ( ! function_exists( 'twentyten_widgets_init' ) ) :
|
||||||
function twentyten_widgets_init() {
|
function twentyten_widgets_init() {
|
||||||
// Area 1
|
// Area 1
|
||||||
register_sidebar( array (
|
register_sidebar( array (
|
||||||
|
@ -218,7 +253,6 @@ function twentyten_widgets_init() {
|
||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
} // end theme_widgets_init
|
}
|
||||||
|
endif;
|
||||||
// Add all the groovy widget areas
|
|
||||||
add_action( 'init', 'twentyten_widgets_init' );
|
add_action( 'init', 'twentyten_widgets_init' );
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
if ( is_single() ) {
|
if ( is_single() ) {
|
||||||
single_post_title(); echo ' | '; bloginfo('name');
|
single_post_title(); echo ' | '; bloginfo('name');
|
||||||
} elseif ( is_home() || is_front_page() ) {
|
} elseif ( is_home() || is_front_page() ) {
|
||||||
bloginfo('name'); echo ' | '; bloginfo('description'); twentyten_get_page_number();
|
bloginfo('name'); echo ' | '; bloginfo('description'); twentyten_the_page_number();
|
||||||
} elseif ( is_page() ) {
|
} elseif ( is_page() ) {
|
||||||
single_post_title(''); echo ' | '; bloginfo('name');
|
single_post_title(''); echo ' | '; bloginfo('name');
|
||||||
} elseif ( is_search() ) {
|
} elseif ( is_search() ) {
|
||||||
printf(__('Search results for "%s"', 'twentyten'), esc_html($s)); twentyten_get_page_number(); echo ' | '; bloginfo('name');
|
printf(__('Search results for "%s"', 'twentyten'), esc_html($s)); twentyten_the_page_number(); echo ' | '; bloginfo('name');
|
||||||
} elseif ( is_404() ) {
|
} elseif ( is_404() ) {
|
||||||
_e('Not Found', 'twentyten'); echo ' | '; bloginfo('name');
|
_e('Not Found', 'twentyten'); echo ' | '; bloginfo('name');
|
||||||
} else {
|
} else {
|
||||||
wp_title(''); echo ' | '; bloginfo('name'); twentyten_get_page_number();
|
wp_title(''); echo ' | '; bloginfo('name'); twentyten_the_page_number();
|
||||||
}
|
}
|
||||||
?></title>
|
?></title>
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@
|
||||||
<link rel="stylesheet" type="text/css" media="print" href="<?php bloginfo('stylesheet_directory'); ?>/print.css" />
|
<link rel="stylesheet" type="text/css" media="print" href="<?php bloginfo('stylesheet_directory'); ?>/print.css" />
|
||||||
|
|
||||||
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
|
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
|
||||||
|
|
||||||
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
|
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
|
||||||
|
|
||||||
<?php wp_head(); ?>
|
<?php wp_head(); ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue