Changeset 19844
- Timestamp:
- 02/06/2012 11:04:56 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentytwelve/functions.php
r19842 r19844 2 2 /** 3 3 * Twenty Twelve functions and definitions 4 * 5 * Sets up the theme and provides some helper functions. Some helper functions 6 * are used in the theme as custom template tags. Others are attached to action and 7 * filter hooks in WordPress to change core functionality. 8 * 9 * The first function, twentytwelve_setup(), sets up the theme by registering support 10 * for various features in WordPress, such as a custom background and a navigation menu. 11 * 12 * When using a child theme (see http://codex.wordpress.org/Theme_Development and 13 * http://codex.wordpress.org/Child_Themes), 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 * 18 * Functions that are not pluggable (not wrapped in function_exists()) are instead attached 19 * to a filter or action hook. 20 * 21 * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. 4 22 * 5 23 * @package WordPress … … 8 26 */ 9 27 10 // Set the content width based on the theme's design and stylesheet. 28 /** 29 * Set the content width based on the theme's design and stylesheet. 30 */ 11 31 if ( ! isset( $content_width ) ) 12 32 $content_width = 584; 13 33 14 add_action( 'wp_enqueue_scripts', 'twentytwelve_enqueue_scripts' ); 15 16 if ( ! function_exists( 'twentytwelve_enqueue_scripts' ) ) : 17 /** 18 * Add theme styles and scripts here 19 */ 20 function twentytwelve_enqueue_scripts() { 21 22 if ( ! is_admin() ) { 23 wp_enqueue_style( 24 'twentytwelve-style', 25 get_bloginfo( 'stylesheet_url' ) 26 ); 27 } 28 29 } 30 endif; // twentytwelve_enqueue_scripts 31 32 // Tell WordPress to run twentytwelve_setup() when the 'after_setup_theme' hook is run. 34 /** 35 * Tell WordPress to run twentytwelve_setup() when the 'after_setup_theme' hook is run. 36 */ 33 37 add_action( 'after_setup_theme', 'twentytwelve_setup' ); 34 38 … … 53 57 load_theme_textdomain( 'twentytwelve', get_template_directory() . '/languages' ); 54 58 55 $locale = get_locale();56 $locale_file = get_template_directory() . "/languages/$locale.php";57 if ( is_readable( $locale_file ) )58 require_once( $locale_file );59 60 59 // Add default posts and comments RSS feed links to <head>. 61 60 add_theme_support( 'automatic-feed-links' ); … … 67 66 add_custom_background(); 68 67 } 69 endif; // twentytwelve_setup 70 71 // Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. 68 endif; 69 70 /** 71 * Enqueues the theme's stylesheet. 72 * 73 * The wp_enqueue_scripts hook is meant for both styles and scripts, and only 74 * fires on the frontend. 75 * 76 * @since Twenty Twelve 1.0 77 */ 78 function twentytwelve_enqueue_scripts() { 79 wp_enqueue_style( 'twentytwelve-style', get_bloginfo( 'stylesheet_url' ) ); 80 } 81 add_action( 'wp_enqueue_scripts', 'twentytwelve_enqueue_scripts' ); 82 83 /** 84 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. 85 * 86 * @since Twenty Twelve 1.0 87 */ 72 88 function twentytwelve_page_menu_args( $args ) { 73 89 $args['show_home'] = true; … … 77 93 78 94 /** 79 * Register our si debars and widgetized areas. Also register the default Epherma widget.95 * Register our single widget area. 80 96 * 81 97 * @since Twenty Twelve 1.0 … … 94 110 95 111 if ( ! function_exists( 'twentytwelve_content_nav' ) ) : 96 // Display navigation to next/previous pages when applicable 112 /** 113 * Display navigation to next/previous pages when applicable 114 * 115 * @since Twenty Twelve 1.0 116 */ 97 117 function twentytwelve_content_nav( $nav_id ) { 98 118 global $wp_query; … … 106 126 <?php endif; 107 127 } 108 endif; // twentytwelve_content_nav128 endif; 109 129 110 130 if ( ! function_exists( 'twentytwelve_comment' ) ) : … … 161 181 <br /> 162 182 <?php endif; ?> 163 164 183 </footer> 165 184 … … 175 194 endswitch; 176 195 } 177 endif; // ends check for twentytwelve_comment()196 endif; 178 197 179 198 if ( ! function_exists( 'twentytwelve_posted_on' ) ) : 180 199 /** 181 200 * Prints HTML with meta information for the current post-date/time and author. 182 * Create your own twentytwelve_posted_on to override in a child theme 201 * 202 * Create your own twentytwelve_posted_on() to override in a child theme. 183 203 * 184 204 * @since Twenty Twelve 1.0
Note: See TracChangeset
for help on using the changeset viewer.