- Timestamp:
- 10/11/2013 10:01:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/functions.php
r25762 r25769 1 1 <?php 2 2 /** 3 * Twenty Fourteen functions and definitions .4 * 5 * Set sup the theme and provides some helper functions, which are used in the3 * Twenty Fourteen functions and definitions 4 * 5 * Set up the theme and provides some helper functions, which are used in the 6 6 * theme as custom template tags. Others are attached to action and filter 7 7 * hooks in WordPress to change core functionality. … … 18 18 * 19 19 * For more information on hooks, actions, and filters, 20 * seehttp://codex.wordpress.org/Plugin_API20 * @link http://codex.wordpress.org/Plugin_API 21 21 * 22 22 * @package WordPress 23 23 * @subpackage Twenty_Fourteen 24 */ 25 26 /** 27 * Sets up the content width value based on the theme's design. 28 * @see twentyfourteen_content_width() for template-specific adjustments. 24 * @since Twenty Fourteen 1.0 25 */ 26 27 /** 28 * Set up the content width value based on the theme's design. 29 * 30 * @link twentyfourteen_content_width() 31 * 32 * @since Twenty Fourteen 1.0 29 33 */ 30 34 if ( ! isset( $content_width ) ) … … 33 37 if ( ! function_exists( 'twentyfourteen_setup' ) ) : 34 38 /** 35 * Sets up theme defaults and registers support for various WordPress features. 39 * Twenty Fourteen setup. 40 * 41 * Set up theme defaults and registers support for various WordPress features. 36 42 * 37 43 * Note that this function is hooked into the after_setup_theme hook, which 38 44 * runs before the init hook. The init hook is too late for some features, such 39 45 * as indicating support post thumbnails. 46 * 47 * @since Twenty Fourteen 1.0 40 48 */ 41 49 function twentyfourteen_setup() { 42 50 43 51 /* 44 * Make sTwenty Fourteen available for translation.52 * Make Twenty Fourteen available for translation. 45 53 * 46 54 * Translations can be added to the /languages/ directory. … … 51 59 load_theme_textdomain( 'twentyfourteen', get_template_directory() . '/languages' ); 52 60 53 /* 54 * This theme styles the visual editor to resemble the theme style. 55 */ 61 // This theme styles the visual editor to resemble the theme style. 56 62 add_editor_style( array( 'editor-style.css', twentyfourteen_font_url() ) ); 57 63 58 // Add sRSS feed links to <head> for posts and comments.64 // Add RSS feed links to <head> for posts and comments. 59 65 add_theme_support( 'automatic-feed-links' ); 60 66 … … 62 68 add_theme_support( 'post-thumbnails' ); 63 69 64 // Add ingseveral sizes for Post Thumbnails.70 // Add several sizes for Post Thumbnails. 65 71 add_image_size( 'featured-thumbnail-large', 672, 0 ); 66 72 add_image_size( 'featured-thumbnail-featured', 672, 336, true ); … … 74 80 75 81 /* 76 * Switch esdefault core markup for search form, comment form, and comments82 * Switch default core markup for search form, comment form, and comments 77 83 * to output valid HTML5. 78 84 */ … … 100 106 101 107 /** 102 * Adjusts content_width value for full-width and attachment templates. 108 * Adjust content_width value for full-width and attachment templates. 109 * 110 * @since Twenty Fourteen 1.0 103 111 * 104 112 * @return void … … 112 120 /** 113 121 * Getter function for Featured Content Plugin. 122 * 123 * @since Twenty Fourteen 1.0 114 124 */ 115 125 function twentyfourteen_get_featured_posts() { … … 121 131 * So that we can use a condition like 122 132 * if ( twentyfourteen_has_featured_posts( 1 ) ) 133 * 134 * @since Twenty Fourteen 1.0 123 135 */ 124 136 function twentyfourteen_has_featured_posts( $minimum = 1 ) { … … 132 144 133 145 /** 134 * Registers two widget areas. 146 * Register two widget areas. 147 * 148 * @since Twenty Fourteen 1.0 135 149 * 136 150 * @return void … … 173 187 * Register Lato Google font for Twenty Fourteen. 174 188 * 189 * @since Twenty Fourteen 1.0 190 * 175 191 * @return void 176 192 */ … … 188 204 189 205 /** 190 * Enqueues scripts and styles for front end. 206 * Enqueue scripts and styles for front end. 207 * 208 * @since Twenty Fourteen 1.0 191 209 * 192 210 * @return void … … 222 240 * Enqueue Google fonts style to admin screen for custom header display. 223 241 * 242 * @since Twenty Fourteen 1.0 243 * 224 244 * @return void 225 245 */ … … 230 250 231 251 /** 232 * Sets the post excerpt length to 20 words. 252 * Set the post excerpt length to 20 words. 253 * 254 * @since Twenty Fourteen 1.0 233 255 * 234 256 * @param int $length … … 241 263 242 264 /** 243 * Returns a "Continue Reading" link for excerpts 265 * Return a "Continue Reading" link for excerpts. 266 * 267 * @since Twenty Fourteen 1.0 244 268 * 245 269 * @return string … … 250 274 251 275 /** 252 * Replace s"[...]" (appended to automatically generated excerpts) with an276 * Replace "[...]" (appended to automatically generated excerpts) with an 253 277 * ellipsis and twentyeleven_continue_reading_link(). 278 * 279 * @since Twenty Fourteen 1.0 254 280 * 255 281 * @param string $more … … 262 288 263 289 /** 264 * Add sa pretty "Continue Reading" link to custom post excerpts.290 * Add a pretty "Continue Reading" link to custom post excerpts. 265 291 * 266 292 * To override this link in a child theme, remove the filter and add your own 267 293 * function tied to the get_the_excerpt filter hook. 294 * 295 * @since Twenty Fourteen 1.0 268 296 * 269 297 * @param string $output … … 280 308 if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : 281 309 /** 282 * Prints the attached image with a link to the next attached image. 310 * Print the attached image with a link to the next attached image. 311 * 312 * @since Twenty Fourteen 1.0 283 313 * 284 314 * @return void … … 289 319 $next_attachment_url = wp_get_attachment_url(); 290 320 291 /* *321 /* 292 322 * Grab the IDs of all the image attachments in a gallery so we can get the URL 293 323 * of the next adjacent image in a gallery, or the first image (if we're … … 333 363 if ( ! function_exists( 'twentyfourteen_list_authors' ) ) : 334 364 /** 335 * Prints a list of all site contributors who published at least one post. 365 * Print a list of all site contributors who published at least one post. 366 * 367 * @since Twenty Fourteen 1.0 336 368 * 337 369 * @return void … … 373 405 374 406 /** 375 * Gets recent formatted posts that are not featured in FC plugin. 376 * 407 * Get recent formatted posts that are not featured in FC plugin. 408 * 409 * @since Twenty Fourteen 1.0 410 * 411 * @return object WP_Query 377 412 */ 378 413 function twentyfourteen_get_recent( $post_format ) { … … 403 438 * Filter the home page posts, and remove formatted posts visible in the sidebar from it 404 439 * 440 * @since Twenty Fourteen 1.0 441 * 442 * @return void 405 443 */ 406 444 function twentyfourteen_pre_get_posts( $query ) { … … 444 482 445 483 /** 446 * Extendsthe default WordPress body classes.484 * Extend the default WordPress body classes. 447 485 * 448 486 * Adds body classes to denote: … … 452 490 * 4. Presence of footer widgets. 453 491 * 492 * @since Twenty Fourteen 1.0 493 * 454 494 * @param array $classes A list of existing body class values. 455 495 * @return array The filtered body class list. … … 476 516 477 517 /** 478 * Extend sthe default WordPress post classes.518 * Extend the default WordPress post classes. 479 519 * 480 520 * Adds a post class to denote: 481 521 * Non-password protected page with a featured image. 522 * 523 * @since Twenty Fourteen 1.0 482 524 * 483 525 * @param array $classes A list of existing post class values. … … 493 535 494 536 /** 495 * Create sa nicely formatted and more specific title element text for output537 * Create a nicely formatted and more specific title element text for output 496 538 * in head of document, based on current view. 539 * 540 * @since Twenty Fourteen 1.0 497 541 * 498 542 * @param string $title Default title text for current view. … … 522 566 add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 ); 523 567 524 /** 525 * Implement the Custom Header feature 526 * 527 */ 568 // Implement Custom Header features. 528 569 require get_template_directory() . '/inc/custom-header.php'; 529 570 530 /** 531 * Custom template tags for this theme. 532 */ 571 // Custom template tags for this theme. 533 572 require get_template_directory() . '/inc/template-tags.php'; 534 573 535 /** 536 * Customizer additions 537 */ 574 // Add Theme Customizer functionality. 538 575 require get_template_directory() . '/inc/customizer.php';
Note: See TracChangeset
for help on using the changeset viewer.