Untitled diff

Erstellt Diff läuft nie ab
3 Entfernungen
611 Zeilen
7 Hinzufügungen
614 Zeilen
<?php
<?php
/**
/**
* Twenty Eleven functions and definitions
* Twenty Eleven functions and definitions
*
*
* Sets up the theme and provides some helper functions. Some helper functions
* Sets up the theme and provides some helper functions. Some helper functions
* are used in the theme as custom template tags. Others are attached to action and
* are used in the theme as custom template tags. Others are attached to action and
* filter hooks in WordPress to change core functionality.
* filter hooks in WordPress to change core functionality.
*
*
* The first function, twentyeleven_setup(), sets up the theme by registering support
* The first function, twentyeleven_setup(), sets up the theme by registering support
* for various features in WordPress, such as post thumbnails, navigation menus, and the like.
* for various features in WordPress, such as post thumbnails, navigation menus, and the like.
*
*
* When using a child theme (see http://codex.wordpress.org/Theme_Development and
* When using a child theme (see http://codex.wordpress.org/Theme_Development and
* http://codex.wordpress.org/Child_Themes), you can override certain functions
* http://codex.wordpress.org/Child_Themes), you can override certain functions
* (those wrapped in a function_exists() call) by defining them first in your child theme's
* (those wrapped in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before the parent
* functions.php file. The child theme's functions.php file is included before the parent
* theme's file, so the child theme functions would be used.
* theme's file, so the child theme functions would be used.
*
*
* Functions that are not pluggable (not wrapped in function_exists()) are instead attached
* Functions that are not pluggable (not wrapped in function_exists()) are instead attached
* to a filter or action hook. The hook can be removed by using remove_action() or
* to a filter or action hook. The hook can be removed by using remove_action() or
* remove_filter() and you can attach your own function to the hook.
* remove_filter() and you can attach your own function to the hook.
*
*
* We can remove the parent theme's hook only after it is attached, which means we need to
* We can remove the parent theme's hook only after it is attached, which means we need to
* wait until setting up the child theme:
* wait until setting up the child theme:
*
*
* <code>
* <code>
* add_action( 'after_setup_theme', 'my_child_theme_setup' );
* add_action( 'after_setup_theme', 'my_child_theme_setup' );
* function my_child_theme_setup() {
* function my_child_theme_setup() {
* // We are providing our own filter for excerpt_length (or using the unfiltered value)
* // We are providing our own filter for excerpt_length (or using the unfiltered value)
* remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
* remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
* ...
* ...
* }
* }
* </code>
* </code>
*
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
*
* @package WordPress
* @package WordPress
* @subpackage Twenty_Eleven
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
* @since Twenty Eleven 1.0
*/
*/
/**
/**
* Set the content width based on the theme's design and stylesheet.
* Set the content width based on the theme's design and stylesheet.
*/
*/
if ( ! isset( $content_width ) )
if ( ! isset( $content_width ) )
$content_width = 584;
$content_width = 584;
/**
/**
* Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run.
* Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run.
*/
*/
add_action( 'after_setup_theme', 'twentyeleven_setup' );
add_action( 'after_setup_theme', 'twentyeleven_setup' );
if ( ! function_exists( 'twentyeleven_setup' ) ):
if ( ! function_exists( 'twentyeleven_setup' ) ):
/**
/**
* Sets up theme defaults and registers support for various WordPress features.
* Sets up theme defaults and registers support for various WordPress features.
*
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
* support post thumbnails.
*
*
* To override twentyeleven_setup() in a child theme, add your own twentyeleven_setup to your child theme's
* To override twentyeleven_setup() in a child theme, add your own twentyeleven_setup to your child theme's
* functions.php file.
* functions.php file.
*
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To style the visual editor.
* @uses add_editor_style() To style the visual editor.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
* and backgrounds, and post formats.
* and backgrounds, and post formats.
* @uses register_nav_menus() To add support for navigation menus.
* @uses register_nav_menus() To add support for navigation menus.
* @uses register_default_headers() To register the default custom header images provided with the theme.
* @uses register_default_headers() To register the default custom header images provided with the theme.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
*
* @since Twenty Eleven 1.0
* @since Twenty Eleven 1.0
*/
*/
function twentyeleven_setup() {
function twentyeleven_setup() {
/* Make Twenty Eleven available for translation.
/* Make Twenty Eleven available for translation.
* Translations can be added to the /languages/ directory.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Twenty Eleven, use a find and replace
* If you're building a theme based on Twenty Eleven, use a find and replace
* to change 'twentyeleven' to the name of your theme in all the template files.
* to change 'twentyeleven' to the name of your theme in all the template files.
*/
*/
load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
// This theme styles the visual editor with editor-style.css to match the theme style.
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
add_editor_style();
// Load up our theme options page and related code.
// Load up our theme options page and related code.
require( get_template_directory() . '/inc/theme-options.php' );
require( get_template_directory() . '/inc/theme-options.php' );
// Grab Twenty Eleven's Ephemera widget.
// Grab Twenty Eleven's Ephemera widget.
require( get_template_directory() . '/inc/widgets.php' );
require( get_template_directory() . '/inc/widgets.php' );
// Add default posts and comments RSS feed links to <head>.
// Add default posts and comments RSS feed links to <head>.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'automatic-feed-links' );
// This theme uses wp_nav_menu() in one location.
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) );
register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) );
// Add support for a variety of post formats
// Add support for a variety of post formats
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
$theme_options = twentyeleven_get_theme_options();
$theme_options = twentyeleven_get_theme_options();