Changeset 21617 for trunk/wp-content/themes/twentytwelve/functions.php
- Timestamp:
- 08/25/2012 04:53:32 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentytwelve/functions.php
r21611 r21617 1 1 <?php 2 2 /** 3 * Twenty Twelve functions and definitions 4 * 5 * Sets up the theme and provides some helper functions . Some helper functions6 * are usedin the theme as custom template tags. Others are attached to action and3 * Twenty Twelve functions and definitions. 4 * 5 * Sets up the theme and provides some helper functions, which are used 6 * in the theme as custom template tags. Others are attached to action and 7 7 * filter hooks in WordPress to change core functionality. 8 *9 * The first function, twentytwelve_setup(), sets up the theme by registering support10 * for various features in WordPress, such as a custom background and a navigation menu.11 8 * 12 9 * When using a child theme (see http://codex.wordpress.org/Theme_Development and … … 27 24 28 25 /** 29 * Set the content widthbased on the theme's design and stylesheet.26 * Sets up the content width value based on the theme's design and stylesheet. 30 27 */ 31 28 if ( ! isset( $content_width ) ) … … 33 30 34 31 /** 35 * Sets up theme defaults and registers support for various WordPress features. 32 * Sets up theme defaults and registers the various WordPress features that 33 * Twenty Twelve supports. 36 34 * 37 35 * @uses load_theme_textdomain() For translation/localization support. 38 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers 39 * and backgrounds, and post formats. 36 * @uses add_editor_style() To add a Visual Editor stylesheet. 37 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, 38 * custom background, and post formats. 40 39 * @uses register_nav_menu() To add support for navigation menus. 41 40 * @uses set_post_thumbnail_size() To set a custom post thumbnail size. … … 46 45 global $twentytwelve_options; 47 46 48 /** 49 * Make Twenty Twelve available for translation. 47 /* 48 * Makes Twenty Twelve available for translation. 49 * 50 50 * Translations can be added to the /languages/ directory. 51 51 * If you're building a theme based on Twenty Twelve, use a find and replace … … 61 61 add_editor_style(); 62 62 63 // Add default posts and comments RSS feed links to <head>.63 // Adds RSS feed links to <head> for posts and comments. 64 64 add_theme_support( 'automatic-feed-links' ); 65 65 66 // Add support for a variety of post formats66 // This theme supports a variety of post formats. 67 67 add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote' ) ); 68 68 … … 70 70 register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) ); 71 71 72 // Add support for custom background. 72 /* 73 * This theme supports custom background color and image, and here 74 * we also set up the default background color. 75 */ 73 76 add_theme_support( 'custom-background', array( 74 77 'default-color' => 'e6e6e6', 75 78 ) ); 76 79 77 // Add custom image size for featured image use, displayed on "standard" posts.80 // This theme uses a custom image size for featured images, displayed on "standard" posts. 78 81 add_theme_support( 'post-thumbnails' ); 79 82 set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop … … 82 85 83 86 /** 84 * Add support for a custom header image.87 * Adds support for a custom header image. 85 88 */ 86 89 require( get_template_directory() . '/inc/custom-header.php' ); 87 90 88 91 /** 89 * Enqueue scripts and styles for front-end.92 * Enqueues scripts and styles for front-end. 90 93 * 91 94 * @since Twenty Twelve 1.0 … … 94 97 global $twentytwelve_options; 95 98 96 /* *97 * Add JavaScript to pages with the comment form to support99 /* 100 * Adds JavaScript to pages with the comment form to support 98 101 * sites with threaded comments (when in use). 99 102 */ … … 101 104 wp_enqueue_script( 'comment-reply' ); 102 105 103 /** 104 * JavaScript for handling navigation menus and the resized 105 * styles for small screen sizes. 106 /* 107 * Adds JavaScript for handling the navigation menu hide-and-show behavior. 106 108 */ 107 109 wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true ); 108 110 109 /* *110 * Load special font CSS file.111 /* 112 * Loads our special font CSS file. 111 113 * Depends on Theme Options setting. 112 114 */ … … 115 117 wp_enqueue_style( 'twentytwelve-fonts', $twentytwelve_options->custom_fonts_url(), array(), null ); 116 118 117 /* *118 * Load our main CSS file.119 /* 120 * Loads our main stylesheet. 119 121 */ 120 122 wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() ); 121 123 122 /* *123 * Load HTML5 shiv for older IE version support for HTML5 elements.124 /* 125 * Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. 124 126 * Ideally, should load after main CSS file. 125 *126 127 * See html5.js link in header.php. 127 128 * … … 165 166 166 167 /** 167 * Get our wp_nav_menu() fallback, wp_page_menu(), toshow a home link.168 * Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link. 168 169 * 169 170 * @since Twenty Twelve 1.0 … … 176 177 177 178 /** 178 * Register our single widget area.179 * Registers our main widget area and the homepage widget areas. 179 180 * 180 181 * @since Twenty Twelve 1.0 … … 214 215 215 216 /** 216 * Count the number of footer sidebars to enable dynamic classes for the footer217 * Counts the number of footer sidebars to enable dynamic classes for the footer. 217 218 * 218 219 * @since Twenty Twelve 1.0 … … 229 230 if ( ! function_exists( 'twentytwelve_content_nav' ) ) : 230 231 /** 231 * Display navigation to next/previous pages when applicable.232 * Displays navigation to next/previous pages when applicable. 232 233 * 233 234 * @since Twenty Twelve 1.0 … … 365 366 * 366 367 * @since Twenty Twelve 1.0 368 * 369 * @param array Existing class values. 370 * @return array Filtered class values. 367 371 */ 368 372 function twentytwelve_body_class( $classes ) { … … 385 389 386 390 /** 387 * Adjust $content width for full-width and single image attachment templates388 * and when there are no active widgets in the sidebar.391 * Adjusts content_width value for full-width and single image attachment 392 * templates, and when there are no active widgets in the sidebar. 389 393 * 390 394 * @since Twenty Twelve 1.0
Note: See TracChangeset
for help on using the changeset viewer.