Changeset 14698 for trunk/wp-content/themes/twentyten/functions.php
- Timestamp:
- 05/16/2010 08:53:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyten/functions.php
r14692 r14698 10 10 * for various features in WordPress, such as post thumbnails, navigation menus, and the like. 11 11 * 12 * When using a child theme (see http://codex.wordpress.org/Theme_Development ), you can13 * override certain functions (those wrapped in a function_exists() call) by defining14 * them first in your child theme's functions.php file. The child theme's functions.php15 * f ile is included before the parent theme's file, so the child theme functions would16 * be used.12 * When using a child theme (see http://codex.wordpress.org/Theme_Development and 13 * http://codex.wordpress.org/Theme_Development), you can override certain functions 14 * (those wrapped in a function_exists() call) by defining them first in your child theme's 15 * functions.php file. The child theme's functions.php file is included before the parent 16 * theme's file, so the child theme functions would be used. 17 17 * 18 18 * Functions that are not pluggable (not wrapped in function_exists()) are instead attached … … 36 36 * @package WordPress 37 37 * @subpackage Twenty_Ten 38 * @since 3.0.038 * @since Twenty Ten 1.0 39 39 */ 40 40 … … 70 70 * @uses set_post_thumbnail_size() To set a custom post thumbnail size. 71 71 * 72 * @since 3.0.072 * @since Twenty Ten 1.0 73 73 */ 74 74 function twentyten_setup() { … … 183 183 * Referenced via add_custom_image_header() in twentyten_setup(). 184 184 * 185 * @since 3.0.0185 * @since Twenty Ten 1.0 186 186 */ 187 187 function twentyten_admin_header_style() { … … 206 206 * Used in Twenty Ten's header.php to add the page number to the <title> HTML tag. 207 207 * 208 * @since 3.0.0208 * @since Twenty Ten 1.0 209 209 */ 210 210 function twentyten_the_page_number() { … … 215 215 endif; 216 216 217 if ( ! function_exists( 'twentyten_page_menu_args' ) ) :218 217 /** 219 218 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. 220 */ 221 function twentyten_page_menu_args($args) { 219 * 220 * To override this in a child theme, remove the filter and optionally add 221 * your own function tied to the wp_page_menu_args filter hook. 222 * 223 * @since Twenty Ten 1.0 224 */ 225 function twentyten_page_menu_args( $args ) { 222 226 $args['show_home'] = true; 223 227 return $args; 224 228 } 225 add_filter('wp_page_menu_args', 'twentyten_page_menu_args'); 226 endif; 229 add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' ); 227 230 228 231 /** … … 232 235 * function tied to the excerpt_length filter hook. 233 236 * 237 * @since Twenty Ten 1.0 234 238 * @return int 235 239 */ … … 245 249 * function tied to the excerpt_more filter hook. 246 250 * 247 * @since 3.0.0251 * @since Twenty Ten 1.0 248 252 * @return string A pretty 'Continue reading' link. 249 253 */ … … 258 262 * Galleries are styled by the theme in Twenty Ten's style.css. 259 263 * 264 * @since Twenty Ten 1.0 260 265 * @return string The gallery style filter, with the styles themselves removed. 261 266 */ … … 274 279 * Used as a callback by wp_list_comments() for displaying the comments. 275 280 * 276 * @since 3.0.0281 * @since Twenty Ten 1.0 277 282 */ 278 283 function twentyten_comment( $comment, $args, $depth ) { … … 316 321 * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own 317 322 * function tied to the init hook. 323 * 324 * @since Twenty Ten 1.0 318 325 * @uses register_sidebar 319 326 */ … … 385 392 ) ); 386 393 } 387 add_action( 'init', 'twentyten_widgets_init' ); 394 /** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */ 395 add_action( 'widgets_init', 'twentyten_widgets_init' ); 388 396 389 397 /** 390 398 * Removes the default styles that are packaged with the Recent Comments widget. 399 * 400 * To override this in a child theme, remove the filter and optionally add your own 401 * function tied to the widgets_init action hook. 402 * 403 * @since Twenty Ten 1.0 391 404 */ 392 405 function twentyten_remove_recent_comments_style() { … … 396 409 add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' ); 397 410 398 /** 399 * Get the URL of the next image in a gallery for attachment pages 400 */ 401 function twentyten_get_next_attachment_url() { 402 global $post; 403 $post = get_post( $post ); 404 $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' ) ) ); 405 406 foreach ( $attachments as $k => $attachment ) { 407 if ( $attachment->ID == $post->ID ) 408 break; 409 } 410 $k++; 411 if ( isset( $attachments[ $k ] ) ) 412 return get_attachment_link( $attachments[ $k ]->ID ); 413 else 414 return get_permalink( $post->post_parent ); 415 } 416 417 /** 418 * Returns HTML with meta information for the current post—date/time and author. 411 if ( ! function_exists( 'twentyten_posted_on' ) ) : 412 /** 413 * Prints HTML with meta information for the current post—date/time and author. 414 * 415 * @since Twenty Ten 1.0 419 416 */ 420 417 function twentyten_posted_on() { 421 return sprintf( __( '<span %1$s>Posted on</span> %2$s by %3$s', 'twentyten' ),418 printf( __( '<span %1$s>Posted on</span> %2$s by %3$s', 'twentyten' ), 422 419 'class="meta-prep meta-prep-author"', 423 420 sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep">', … … 434 431 435 432 } 436 437 /** 438 * Returns HTML with meta information for the current post—category, tags and permalink 439 */ 440 433 endif; 434 435 if ( ! function_exists( 'twentyten_posted_in' ) ) : 436 /** 437 * Prints HTML with meta information for the current post (category, tags and permalink). 438 * 439 * @since Twenty Ten 1.0 440 */ 441 441 function twentyten_posted_in() { 442 $tag_list = get_the_tag_list( '', ', ', '' ); 442 // Retrieves tag list of current post, separated by commas. 443 $tag_list = get_the_tag_list( '', ', ' ); 443 444 if ( $tag_list ) { 444 $ utility_text= __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );445 $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' ); 445 446 } else { 446 $ utility_text= __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );447 $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' ); 447 448 } 448 return sprintf( 449 $utility_text, 449 // Prints the string, replacing the placeholders. 450 printf( 451 $posted_in, 450 452 get_the_category_list( ', ' ), 451 453 $tag_list, 452 454 get_permalink(), 453 the_title_attribute( 'echo=0' ), 454 get_post_comments_feed_link() 455 the_title_attribute( 'echo=0' ) 455 456 ); 456 457 } 458 endif;
Note: See TracChangeset
for help on using the changeset viewer.