web/wp-content/themes/twentyten/functions.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
   113 		// Don't support text inside the header image.
   113 		// Don't support text inside the header image.
   114 		'header-text' => false,
   114 		'header-text' => false,
   115 		// Callback for styling the header preview in the admin.
   115 		// Callback for styling the header preview in the admin.
   116 		'admin-head-callback' => 'twentyten_admin_header_style',
   116 		'admin-head-callback' => 'twentyten_admin_header_style',
   117 	);
   117 	);
   118 	
   118 
   119 	add_theme_support( 'custom-header', $custom_header_support );
   119 	add_theme_support( 'custom-header', $custom_header_support );
   120 	
   120 
   121 	if ( ! function_exists( 'get_custom_header' ) ) {
   121 	if ( ! function_exists( 'get_custom_header' ) ) {
   122 		// This is all for compatibility with versions of WordPress prior to 3.4.
   122 		// This is all for compatibility with versions of WordPress prior to 3.4.
   123 		define( 'HEADER_TEXTCOLOR', '' );
   123 		define( 'HEADER_TEXTCOLOR', '' );
   124 		define( 'NO_HEADER_TEXT', true );
   124 		define( 'NO_HEADER_TEXT', true );
   125 		define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
   125 		define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
   222  * your own function tied to the wp_page_menu_args filter hook.
   222  * your own function tied to the wp_page_menu_args filter hook.
   223  *
   223  *
   224  * @since Twenty Ten 1.0
   224  * @since Twenty Ten 1.0
   225  */
   225  */
   226 function twentyten_page_menu_args( $args ) {
   226 function twentyten_page_menu_args( $args ) {
   227 	$args['show_home'] = true;
   227 	if ( ! isset( $args['show_home'] ) )
       
   228 		$args['show_home'] = true;
   228 	return $args;
   229 	return $args;
   229 }
   230 }
   230 add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
   231 add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
   231 
   232 
   232 /**
   233 /**
   241 function twentyten_excerpt_length( $length ) {
   242 function twentyten_excerpt_length( $length ) {
   242 	return 40;
   243 	return 40;
   243 }
   244 }
   244 add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
   245 add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
   245 
   246 
       
   247 if ( ! function_exists( 'twentyten_continue_reading_link' ) ) :
   246 /**
   248 /**
   247  * Returns a "Continue Reading" link for excerpts
   249  * Returns a "Continue Reading" link for excerpts
   248  *
   250  *
   249  * @since Twenty Ten 1.0
   251  * @since Twenty Ten 1.0
   250  * @return string "Continue Reading" link
   252  * @return string "Continue Reading" link
   251  */
   253  */
   252 function twentyten_continue_reading_link() {
   254 function twentyten_continue_reading_link() {
   253 	return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
   255 	return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
   254 }
   256 }
       
   257 endif;
   255 
   258 
   256 /**
   259 /**
   257  * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
   260  * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
   258  *
   261  *
   259  * To override this in a child theme, remove the filter and add your own
   262  * To override this in a child theme, remove the filter and add your own
   328 	switch ( $comment->comment_type ) :
   331 	switch ( $comment->comment_type ) :
   329 		case '' :
   332 		case '' :
   330 	?>
   333 	?>
   331 	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
   334 	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
   332 		<div id="comment-<?php comment_ID(); ?>">
   335 		<div id="comment-<?php comment_ID(); ?>">
   333 		<div class="comment-author vcard">
   336 			<div class="comment-author vcard">
   334 			<?php echo get_avatar( $comment, 40 ); ?>
   337 				<?php echo get_avatar( $comment, 40 ); ?>
   335 			<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
   338 				<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
   336 		</div><!-- .comment-author .vcard -->
   339 			</div><!-- .comment-author .vcard -->
   337 		<?php if ( $comment->comment_approved == '0' ) : ?>
   340 			<?php if ( $comment->comment_approved == '0' ) : ?>
   338 			<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
   341 				<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
   339 			<br />
   342 				<br />
   340 		<?php endif; ?>
   343 			<?php endif; ?>
   341 
   344 
   342 		<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
   345 			<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
   343 			<?php
   346 				<?php
   344 				/* translators: 1: date, 2: time */
   347 					/* translators: 1: date, 2: time */
   345 				printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
   348 					printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
   346 			?>
   349 				?>
   347 		</div><!-- .comment-meta .commentmetadata -->
   350 			</div><!-- .comment-meta .commentmetadata -->
   348 
   351 
   349 		<div class="comment-body"><?php comment_text(); ?></div>
   352 			<div class="comment-body"><?php comment_text(); ?></div>
   350 
   353 
   351 		<div class="reply">
   354 			<div class="reply">
   352 			<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
   355 				<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
   353 		</div><!-- .reply -->
   356 			</div><!-- .reply -->
   354 	</div><!-- #comment-##  -->
   357 		</div><!-- #comment-##  -->
   355 
   358 
   356 	<?php
   359 	<?php
   357 			break;
   360 			break;
   358 		case 'pingback'  :
   361 		case 'pingback'  :
   359 		case 'trackback' :
   362 		case 'trackback' :