Changeset 25625 for trunk/src/wp-content/themes/twentyeleven/functions.php
- Timestamp:
- 09/25/2013 04:49:36 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyeleven/functions.php
r24709 r25625 52 52 if ( ! function_exists( 'twentyeleven_setup' ) ): 53 53 /** 54 * Set sup theme defaults and registers support for various WordPress features.54 * Set up theme defaults and registers support for various WordPress features. 55 55 * 56 56 * Note that this function is hooked into the after_setup_theme hook, which runs … … 61 61 * functions.php file. 62 62 * 63 * @uses load_theme_textdomain() For translation/localization support.64 * @uses add_editor_style() To style the visual editor.65 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers66 * and backgrounds, and post formats.67 * @uses register_nav_menus() To add support for navigation menus.63 * @uses load_theme_textdomain() For translation/localization support. 64 * @uses add_editor_style() To style the visual editor. 65 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers 66 * and backgrounds, and post formats. 67 * @uses register_nav_menus() To add support for navigation menus. 68 68 * @uses register_default_headers() To register the default custom header images provided with the theme. 69 * @uses set_post_thumbnail_size() To set a custom post thumbnail size.69 * @uses set_post_thumbnail_size() To set a custom post thumbnail size. 70 70 * 71 71 * @since Twenty Eleven 1.0 … … 73 73 function twentyeleven_setup() { 74 74 75 /* Make Twenty Eleven available for translation. 75 /** 76 * Make Twenty Eleven available for translation. 76 77 * Translations can be added to the /languages/ directory. 77 * If you're building a theme based on Twenty Eleven, use a find and replace 78 * to change 'twentyeleven' to the name of your theme in all the template files. 78 * If you're building a theme based on Twenty Eleven, use 79 * a find and replace to change 'twentyeleven' to the name 80 * of your theme in all the template files. 79 81 */ 80 82 load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' ); … … 106 108 // Add support for custom backgrounds. 107 109 add_theme_support( 'custom-background', array( 108 // Let WordPress know what our default background color is. 109 // This is dependent on our current color scheme. 110 /** 111 * Let WordPress know what our default background color is. 112 * This is dependent on our current color scheme. 113 */ 110 114 'default-color' => $default_background_color, 111 115 ) ); … … 119 123 'default-text-color' => '000', 120 124 // The height and width of our custom header. 125 /** 126 * Filter the Twenty Eleven default header image width. 127 * 128 * @since Twenty Eleven 1.0 129 * 130 * @param int The default header image width in pixels. Default 1000. 131 */ 121 132 'width' => apply_filters( 'twentyeleven_header_image_width', 1000 ), 133 /** 134 * Filter the Twenty Eleven default header image height. 135 * 136 * @since Twenty Eleven 1.0 137 * 138 * @param int The default header image height in pixels. Default 288. 139 */ 122 140 'height' => apply_filters( 'twentyeleven_header_image_height', 288 ), 123 141 // Support flexible heights. … … 145 163 } 146 164 147 // We'll be using post thumbnails for custom header images on posts and pages. 148 // We want them to be the size of the header image that we just defined 149 // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 165 /** 166 * We'll be using post thumbnails for custom header images on posts and pages. 167 * We want them to be the size of the header image that we just defined. 168 * Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 169 */ 150 170 set_post_thumbnail_size( $custom_header_support['width'], $custom_header_support['height'], true ); 151 171 152 // Add Twenty Eleven's custom image sizes. 153 // Used for large feature (header) images. 172 /** 173 * Add Twenty Eleven's custom image sizes. 174 * Used for large feature (header) images. 175 */ 154 176 add_image_size( 'large-feature', $custom_header_support['width'], $custom_header_support['height'], true ); 155 177 // Used for featured posts if a large-feature doesn't exist. … … 212 234 if ( ! function_exists( 'twentyeleven_header_style' ) ) : 213 235 /** 214 * Styles the header image and text displayed on the blog 236 * Styles the header image and text displayed on the blog. 215 237 * 216 238 * @since Twenty Eleven 1.0 … … 328 350 329 351 /** 330 * Sets the post excerpt length to 40 words. 331 * 332 * To override this length in a child theme, remove the filter and add your own 333 * function tied to the excerpt_length filter hook. 352 * Set the post excerpt length to 40 words. 353 * 354 * To override this length in a child theme, remove 355 * the filter and add your own function tied to 356 * the excerpt_length filter hook. 357 * 358 * @since Twenty Eleven 1.0 359 * 360 * @param int $length The number of excerpt characters. 361 * @return int The filtered number of characters. 334 362 */ 335 363 function twentyeleven_excerpt_length( $length ) { … … 340 368 if ( ! function_exists( 'twentyeleven_continue_reading_link' ) ) : 341 369 /** 342 * Returns a "Continue Reading" link for excerpts 370 * Return a "Continue Reading" link for excerpts 371 * 372 * @since Twenty Eleven 1.0 373 * 374 * @return string The "Continue Reading" HTML link. 343 375 */ 344 376 function twentyeleven_continue_reading_link() { … … 348 380 349 381 /** 350 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link(). 382 * Replace "[...]" in the Read More link with an ellipsis. 383 * 384 * The "[...]" is appended to automatically generated excerpts. 351 385 * 352 386 * To override this in a child theme, remove the filter and add your own 353 387 * function tied to the excerpt_more filter hook. 388 * 389 * @since Twenty Eleven 1.0 390 * 391 * @param string $more The Read More text. 392 * @return The filtered Read More text. 354 393 */ 355 394 function twentyeleven_auto_excerpt_more( $more ) { … … 359 398 360 399 /** 361 * Add sa pretty "Continue Reading" link to custom post excerpts.400 * Add a pretty "Continue Reading" link to custom post excerpts. 362 401 * 363 402 * To override this link in a child theme, remove the filter and add your own 364 403 * function tied to the get_the_excerpt filter hook. 404 * 405 * @since Twenty Eleven 1.0 406 * 407 * @param string $output The "Continue Reading" link. 408 * @return string The filtered "Continue Reading" link. 365 409 */ 366 410 function twentyeleven_custom_excerpt_more( $output ) { … … 373 417 374 418 /** 375 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. 419 * Show a home link for the wp_nav_menu() fallback, wp_page_menu(). 420 * 421 * @since Twenty Eleven 1.0 422 * 423 * @param array $args The page menu arguments. @see wp_page_menu() 424 * @return array The filtered page menu arguments. 376 425 */ 377 426 function twentyeleven_page_menu_args( $args ) { … … 383 432 384 433 /** 385 * Register our sidebars and widgetized areas. Also register the default Epherma widget. 434 * Register sidebars and widgetized areas. 435 * 436 * Also register the default Epherma widget. 386 437 * 387 438 * @since Twenty Eleven 1.0 … … 444 495 if ( ! function_exists( 'twentyeleven_content_nav' ) ) : 445 496 /** 446 * Display navigation to next/previous pages when applicable 497 * Display navigation to next/previous pages when applicable. 498 * 499 * @since Twenty Eleven 1.0 500 * 501 * @param string $html_id The HTML id attribute. 447 502 */ 448 503 function twentyeleven_content_nav( $html_id ) { … … 463 518 * post permalink is used as a fallback. 464 519 * 520 * @since Twenty Eleven 1.0 521 * 465 522 * @uses get_url_in_content() to get the first URL from the post content. 466 523 * 467 * @return string 524 * @return string The first link. 468 525 */ 469 526 function twentyeleven_get_first_url() { … … 474 531 $has_url = twentyeleven_url_grabber(); 475 532 533 //duplicate_hook 476 534 return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); 477 535 } … … 481 539 * 482 540 * @since Twenty Eleven 1.0 541 * 483 542 * @return string|bool URL or false when no link is present. 484 543 */ … … 491 550 492 551 /** 493 * Count the number of footer sidebars to enable dynamic classes for the footer 552 * Count the number of footer sidebars to enable dynamic classes for the footer. 553 * 554 * @since Twenty Eleven 1.0 494 555 */ 495 556 function twentyeleven_footer_sidebar_class() { … … 533 594 * 534 595 * @since Twenty Eleven 1.0 596 * 597 * @param object $comment The comment object. 598 * @param array $args An array of comment arguments. @see get_comment_reply_link() 599 * @param int $depth The depth of the comment. 535 600 */ 536 601 function twentyeleven_comment( $comment, $args, $depth ) { … … 594 659 if ( ! function_exists( 'twentyeleven_posted_on' ) ) : 595 660 /** 596 * Prints HTML with meta information for the current post-date/time and author. 661 * Print HTML with meta information for the current post-date/time and author. 662 * 597 663 * Create your own twentyeleven_posted_on to override in a child theme 598 664 * … … 613 679 614 680 /** 615 * Adds two classes to the array of body classes. 681 * Add two classes to the array of body classes. 682 * 616 683 * The first is if the site has only had one author with published posts. 617 684 * The second is if a singular post being displayed 618 685 * 619 686 * @since Twenty Eleven 1.0 687 * 688 * @param array $classes Existing body classes. 689 * @return array The filtered array of body classes. 620 690 */ 621 691 function twentyeleven_body_classes( $classes ) { … … 632 702 633 703 /** 634 * Retrieve sthe IDs for images in a gallery.635 * 636 * @uses get_post_galleries() first, if available. Falls back to shortcode parsing,637 * then as last option uses a get_posts() call.704 * Retrieve the IDs for images in a gallery. 705 * 706 * @uses get_post_galleries() First, if available. Falls back to shortcode parsing, 707 * then as last option uses a get_posts() call. 638 708 * 639 709 * @since Twenty Eleven 1.6.
Note: See TracChangeset
for help on using the changeset viewer.