Changeset 18272
- Timestamp:
- 06/11/2011 06:30:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/functions.php
r18244 r18272 101 101 register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) ); 102 102 103 /** 104 * Add support for an Aside Post Format 105 */ 103 // Add support for a variety of post formats 106 104 add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) ); 107 105 108 /** 109 * Add support for custom backgrounds 110 */ 106 // Add support for custom backgrounds 111 107 add_custom_background(); 112 108 113 // This theme uses Feature Imagesfor per-post/per-page Custom Header images109 // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images 114 110 add_theme_support( 'post-thumbnails' ); 115 111 116 / **117 * Add support for Custom Headers 118 */112 // The next four constants set how twentyeleven supports custom headers 113 114 // The default header text color 119 115 define( 'HEADER_TEXTCOLOR', '000' ); 120 116 121 // No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI.122 define( 'HEADER_IMAGE', '' ); // Leaving empty for random image rotation.123 124 // The height and width of your custom header. You can hook into the theme's own filters to change these values.117 // By leaving empty, we default to random image rotation 118 define( 'HEADER_IMAGE', '' ); 119 120 // The height and width of your custom header. 125 121 // Add a filter to twentyeleven_header_image_width and twentyeleven_header_image_height to change these values. 126 122 define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) ); … … 128 124 129 125 // We'll be using post thumbnails for custom header images on posts and pages. 130 // We want them to be 1000 pixels wide by 288 pixels tall.126 // We want them to be the size of the header image that we just defined 131 127 // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 132 128 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); 133 129 134 130 // Add Twenty Eleven's custom image sizes 135 add_image_size( 'large-feature', HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Used for large feature images131 add_image_size( 'large-feature', HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Used for large feature (header) images 136 132 add_image_size( 'small-feature', 500, 300 ); // Used for featured posts if a large-feature doesn't exist 137 133 … … 355 351 356 352 /** 357 * Add custom body classes358 */359 function twentyeleven_singular_class( $classes ) {360 if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )361 $classes[] = 'singular';362 363 return $classes;364 }365 add_filter( 'body_class', 'twentyeleven_singular_class' );366 367 /**368 353 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. 369 354 */ … … 564 549 /** 565 550 * Prints HTML with meta information for the current post-date/time and author. 551 * Create your own twentyeleven_posted_on to override in a child theme 566 552 * 567 553 * @since Twenty Eleven 1.0 … … 581 567 582 568 /** 583 * Adds Twenty Eleven author class to the array of body classes. 584 * 585 * @since Twenty Eleven 1.0 586 */ 587 function twentyeleven_author_class( $classes ) { 569 * Adds two classes to the array of body classes. 570 * The first is if the site has only had one author with published posts. 571 * The second is if a singular post being displayed 572 * 573 * @since Twenty Eleven 1.0 574 */ 575 function twentyeleven_body_classes( $classes ) { 588 576 589 577 if ( ! is_multi_author() ) { 590 578 $classes[] = 'single-author'; 591 579 } 592 580 581 if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) ) 582 $classes[] = 'singular'; 583 593 584 return $classes; 594 585 } 595 add_filter( 'body_class', 'twentyeleven_author_class' ); 586 add_filter( 'body_class', 'twentyeleven_body_classes' ); 587
Note: See TracChangeset
for help on using the changeset viewer.