web/wp-content/themes/twentyten/functions.php
author Anthony Ly <anthonyly.com@gmail.com>
Mon, 10 Dec 2012 16:45:00 -0800
changeset 197 6f2ea86df1aa
parent 194 32102edaa81b
child 204 09a1c134465b
permissions -rw-r--r--
Remplacement des logos footer partenariat, style et liens. Correction traduction.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     1
<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     2
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     3
 * TwentyTen functions and definitions
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     4
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     5
 * Sets up the theme and provides some helper functions. Some helper functions
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     6
 * are used in the theme as custom template tags. Others are attached to action and
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     7
 * filter hooks in WordPress to change core functionality.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     8
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     9
 * The first function, twentyten_setup(), sets up the theme by registering support
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    10
 * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    11
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    12
 * When using a child theme (see http://codex.wordpress.org/Theme_Development and
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    13
 * http://codex.wordpress.org/Child_Themes), you can override certain functions
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    14
 * (those wrapped in a function_exists() call) by defining them first in your child theme's
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    15
 * functions.php file. The child theme's functions.php file is included before the parent
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    16
 * theme's file, so the child theme functions would be used.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    17
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    18
 * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    19
 * to a filter or action hook. The hook can be removed by using remove_action() or
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    20
 * remove_filter() and you can attach your own function to the hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    21
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    22
 * We can remove the parent theme's hook only after it is attached, which means we need to
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    23
 * wait until setting up the child theme:
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    24
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    25
 * <code>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    26
 * add_action( 'after_setup_theme', 'my_child_theme_setup' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    27
 * function my_child_theme_setup() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    28
 *     // We are providing our own filter for excerpt_length (or using the unfiltered value)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    29
 *     remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    30
 *     ...
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    31
 * }
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    32
 * </code>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    33
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    34
 * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    35
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    36
 * @package WordPress
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    37
 * @subpackage Twenty_Ten
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    38
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    39
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    40
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    41
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    42
 * Set the content width based on the theme's design and stylesheet.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    43
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    44
 * Used to set the width of images and content. Should be equal to the width the theme
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    45
 * is designed for, generally via the style.css stylesheet.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    46
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    47
if ( ! isset( $content_width ) )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    48
	$content_width = 640;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    49
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    50
/** Tell WordPress to run twentyten_setup() when the 'after_setup_theme' hook is run. */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    51
add_action( 'after_setup_theme', 'twentyten_setup' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    52
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    53
if ( ! function_exists( 'twentyten_setup' ) ):
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    54
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    55
 * Sets up theme defaults and registers support for various WordPress features.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    56
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    57
 * Note that this function is hooked into the after_setup_theme hook, which runs
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    58
 * before the init hook. The init hook is too late for some features, such as indicating
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    59
 * support post thumbnails.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    60
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    61
 * To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    62
 * functions.php file.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    63
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    64
 * @uses add_theme_support() To add support for post thumbnails, custom headers and backgrounds, and automatic feed links.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    65
 * @uses register_nav_menus() To add support for navigation menus.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    66
 * @uses add_editor_style() To style the visual editor.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    67
 * @uses load_theme_textdomain() For translation/localization support.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    68
 * @uses register_default_headers() To register the default custom header images provided with the theme.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    69
 * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    70
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    71
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    72
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    73
function twentyten_setup() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    74
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    75
	// This theme styles the visual editor with editor-style.css to match the theme style.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    76
	add_editor_style();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    77
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    78
	// Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    79
	add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    80
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    81
	// This theme uses post thumbnails
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    82
	add_theme_support( 'post-thumbnails' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    83
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    84
	// Add default posts and comments RSS feed links to head
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    85
	add_theme_support( 'automatic-feed-links' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    86
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    87
	// Make theme available for translation
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    88
	// Translations can be filed in the /languages/ directory
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    89
	load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    90
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    91
	// This theme uses wp_nav_menu() in one location.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    92
	register_nav_menus( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    93
		'primary' => __( 'Primary Navigation', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    94
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    95
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    96
	// This theme allows users to set a custom background.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    97
	add_theme_support( 'custom-background', array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    98
		// Let WordPress know what our default background color is.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    99
		'default-color' => 'f1f1f1',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   100
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   101
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   102
	// The custom header business starts here.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   103
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   104
	$custom_header_support = array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   105
		// The default image to use.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   106
		// The %s is a placeholder for the theme template directory URI.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   107
		'default-image' => '%s/images/headers/path.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   108
		// The height and width of our custom header.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   109
		'width' => apply_filters( 'twentyten_header_image_width', 940 ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   110
		'height' => apply_filters( 'twentyten_header_image_height', 198 ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   111
		// Support flexible heights.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   112
		'flex-height' => true,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   113
		// Don't support text inside the header image.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   114
		'header-text' => false,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   115
		// Callback for styling the header preview in the admin.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   116
		'admin-head-callback' => 'twentyten_admin_header_style',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   117
	);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   118
	
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   119
	add_theme_support( 'custom-header', $custom_header_support );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   120
	
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   121
	if ( ! function_exists( 'get_custom_header' ) ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   122
		// This is all for compatibility with versions of WordPress prior to 3.4.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   123
		define( 'HEADER_TEXTCOLOR', '' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   124
		define( 'NO_HEADER_TEXT', true );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   125
		define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   126
		define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   127
		define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   128
		add_custom_image_header( '', $custom_header_support['admin-head-callback'] );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   129
		add_custom_background();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   130
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   131
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   132
	// We'll be using post thumbnails for custom header images on posts and pages.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   133
	// We want them to be 940 pixels wide by 198 pixels tall.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   134
	// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   135
	set_post_thumbnail_size( $custom_header_support['width'], $custom_header_support['height'], true );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   136
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   137
	// ... and thus ends the custom header business.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   138
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   139
	// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   140
	register_default_headers( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   141
		'berries' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   142
			'url' => '%s/images/headers/berries.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   143
			'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   144
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   145
			'description' => __( 'Berries', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   146
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   147
		'cherryblossom' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   148
			'url' => '%s/images/headers/cherryblossoms.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   149
			'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   150
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   151
			'description' => __( 'Cherry Blossoms', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   152
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   153
		'concave' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   154
			'url' => '%s/images/headers/concave.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   155
			'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   156
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   157
			'description' => __( 'Concave', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   158
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   159
		'fern' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   160
			'url' => '%s/images/headers/fern.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   161
			'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   162
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   163
			'description' => __( 'Fern', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   164
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   165
		'forestfloor' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   166
			'url' => '%s/images/headers/forestfloor.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   167
			'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   168
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   169
			'description' => __( 'Forest Floor', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   170
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   171
		'inkwell' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   172
			'url' => '%s/images/headers/inkwell.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   173
			'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   174
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   175
			'description' => __( 'Inkwell', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   176
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   177
		'path' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   178
			'url' => '%s/images/headers/path.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   179
			'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   180
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   181
			'description' => __( 'Path', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   182
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   183
		'sunset' => array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   184
			'url' => '%s/images/headers/sunset.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   185
			'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   186
			/* translators: header image description */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   187
			'description' => __( 'Sunset', 'twentyten' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   188
		)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   189
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   190
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   191
endif;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   192
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   193
if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   194
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   195
 * Styles the header image displayed on the Appearance > Header admin panel.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   196
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   197
 * Referenced via add_custom_image_header() in twentyten_setup().
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   198
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   199
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   200
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   201
function twentyten_admin_header_style() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   202
?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   203
<style type="text/css">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   204
/* Shows the same border as on front end */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   205
#headimg {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   206
	border-bottom: 1px solid #000;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   207
	border-top: 4px solid #000;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   208
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   209
/* If header-text was supported, you would style the text with these selectors:
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   210
	#headimg #name { }
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   211
	#headimg #desc { }
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   212
*/
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   213
</style>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   214
<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   215
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   216
endif;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   217
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   218
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   219
 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   220
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   221
 * To override this in a child theme, remove the filter and optionally add
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   222
 * your own function tied to the wp_page_menu_args filter hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   223
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   224
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   225
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   226
function twentyten_page_menu_args( $args ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   227
	$args['show_home'] = true;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   228
	return $args;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   229
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   230
add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   231
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   232
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   233
 * Sets the post excerpt length to 40 characters.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   234
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   235
 * To override this length in a child theme, remove the filter and add your own
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   236
 * function tied to the excerpt_length filter hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   237
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   238
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   239
 * @return int
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   240
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   241
function twentyten_excerpt_length( $length ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   242
	return 40;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   243
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   244
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   245
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   246
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   247
 * Returns a "Continue Reading" link for excerpts
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   248
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   249
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   250
 * @return string "Continue Reading" link
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   251
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   252
function twentyten_continue_reading_link() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   253
	return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   254
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   255
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   256
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   257
 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   258
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   259
 * To override this in a child theme, remove the filter and add your own
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   260
 * function tied to the excerpt_more filter hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   261
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   262
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   263
 * @return string An ellipsis
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   264
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   265
function twentyten_auto_excerpt_more( $more ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   266
	return ' &hellip;' . twentyten_continue_reading_link();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   267
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   268
add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   269
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   270
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   271
 * Adds a pretty "Continue Reading" link to custom post excerpts.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   272
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   273
 * To override this link in a child theme, remove the filter and add your own
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   274
 * function tied to the get_the_excerpt filter hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   275
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   276
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   277
 * @return string Excerpt with a pretty "Continue Reading" link
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   278
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   279
function twentyten_custom_excerpt_more( $output ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   280
	if ( has_excerpt() && ! is_attachment() ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   281
		$output .= twentyten_continue_reading_link();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   282
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   283
	return $output;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   284
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   285
add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   286
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   287
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   288
 * Remove inline styles printed when the gallery shortcode is used.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   289
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   290
 * Galleries are styled by the theme in Twenty Ten's style.css. This is just
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   291
 * a simple filter call that tells WordPress to not use the default styles.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   292
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   293
 * @since Twenty Ten 1.2
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   294
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   295
add_filter( 'use_default_gallery_style', '__return_false' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   296
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   297
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   298
 * Deprecated way to remove inline styles printed when the gallery shortcode is used.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   299
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   300
 * This function is no longer needed or used. Use the use_default_gallery_style
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   301
 * filter instead, as seen above.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   302
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   303
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   304
 * @deprecated Deprecated in Twenty Ten 1.2 for WordPress 3.1
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   305
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   306
 * @return string The gallery style filter, with the styles themselves removed.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   307
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   308
function twentyten_remove_gallery_css( $css ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   309
	return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   310
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   311
// Backwards compatibility with WordPress 3.0.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   312
if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   313
	add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   314
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   315
if ( ! function_exists( 'twentyten_comment' ) ) :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   316
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   317
 * Template for comments and pingbacks.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   318
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   319
 * To override this walker in a child theme without modifying the comments template
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   320
 * simply create your own twentyten_comment(), and that function will be used instead.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   321
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   322
 * Used as a callback by wp_list_comments() for displaying the comments.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   323
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   324
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   325
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   326
function twentyten_comment( $comment, $args, $depth ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   327
	$GLOBALS['comment'] = $comment;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   328
	switch ( $comment->comment_type ) :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   329
		case '' :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   330
	?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   331
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   332
		<div id="comment-<?php comment_ID(); ?>">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   333
		<div class="comment-author vcard">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   334
			<?php echo get_avatar( $comment, 40 ); ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   335
			<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   336
		</div><!-- .comment-author .vcard -->
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   337
		<?php if ( $comment->comment_approved == '0' ) : ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   338
			<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   339
			<br />
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   340
		<?php endif; ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   341
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   342
		<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   343
			<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   344
				/* translators: 1: date, 2: time */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   345
				printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   346
			?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   347
		</div><!-- .comment-meta .commentmetadata -->
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   348
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   349
		<div class="comment-body"><?php comment_text(); ?></div>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   350
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   351
		<div class="reply">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   352
			<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   353
		</div><!-- .reply -->
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   354
	</div><!-- #comment-##  -->
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   355
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   356
	<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   357
			break;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   358
		case 'pingback'  :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   359
		case 'trackback' :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   360
	?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   361
	<li class="post pingback">
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   362
		<p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   363
	<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   364
			break;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   365
	endswitch;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   366
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   367
endif;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   368
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   369
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   370
 * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   371
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   372
 * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   373
 * function tied to the init hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   374
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   375
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   376
 * @uses register_sidebar
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   377
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   378
function twentyten_widgets_init() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   379
	// Area 1, located at the top of the sidebar.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   380
	register_sidebar( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   381
		'name' => __( 'Primary Widget Area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   382
		'id' => 'primary-widget-area',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   383
		'description' => __( 'The primary widget area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   384
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   385
		'after_widget' => '</li>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   386
		'before_title' => '<h3 class="widget-title">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   387
		'after_title' => '</h3>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   388
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   389
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   390
	// Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   391
	register_sidebar( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   392
		'name' => __( 'Secondary Widget Area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   393
		'id' => 'secondary-widget-area',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   394
		'description' => __( 'The secondary widget area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   395
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   396
		'after_widget' => '</li>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   397
		'before_title' => '<h3 class="widget-title">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   398
		'after_title' => '</h3>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   399
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   400
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   401
	// Area 3, located in the footer. Empty by default.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   402
	register_sidebar( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   403
		'name' => __( 'First Footer Widget Area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   404
		'id' => 'first-footer-widget-area',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   405
		'description' => __( 'The first footer widget area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   406
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   407
		'after_widget' => '</li>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   408
		'before_title' => '<h3 class="widget-title">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   409
		'after_title' => '</h3>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   410
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   411
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   412
	// Area 4, located in the footer. Empty by default.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   413
	register_sidebar( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   414
		'name' => __( 'Second Footer Widget Area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   415
		'id' => 'second-footer-widget-area',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   416
		'description' => __( 'The second footer widget area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   417
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   418
		'after_widget' => '</li>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   419
		'before_title' => '<h3 class="widget-title">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   420
		'after_title' => '</h3>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   421
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   422
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   423
	// Area 5, located in the footer. Empty by default.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   424
	register_sidebar( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   425
		'name' => __( 'Third Footer Widget Area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   426
		'id' => 'third-footer-widget-area',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   427
		'description' => __( 'The third footer widget area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   428
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   429
		'after_widget' => '</li>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   430
		'before_title' => '<h3 class="widget-title">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   431
		'after_title' => '</h3>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   432
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   433
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   434
	// Area 6, located in the footer. Empty by default.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   435
	register_sidebar( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   436
		'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   437
		'id' => 'fourth-footer-widget-area',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   438
		'description' => __( 'The fourth footer widget area', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   439
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   440
		'after_widget' => '</li>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   441
		'before_title' => '<h3 class="widget-title">',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   442
		'after_title' => '</h3>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   443
	) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   444
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   445
/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   446
add_action( 'widgets_init', 'twentyten_widgets_init' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   447
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   448
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   449
 * Removes the default styles that are packaged with the Recent Comments widget.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   450
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   451
 * To override this in a child theme, remove the filter and optionally add your own
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   452
 * function tied to the widgets_init action hook.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   453
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   454
 * This function uses a filter (show_recent_comments_widget_style) new in WordPress 3.1
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   455
 * to remove the default style. Using Twenty Ten 1.2 in WordPress 3.0 will show the styles,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   456
 * but they won't have any effect on the widget in default Twenty Ten styling.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   457
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   458
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   459
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   460
function twentyten_remove_recent_comments_style() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   461
	add_filter( 'show_recent_comments_widget_style', '__return_false' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   462
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   463
add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   464
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   465
if ( ! function_exists( 'twentyten_posted_on' ) ) :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   466
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   467
 * Prints HTML with meta information for the current post-date/time and author.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   468
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   469
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   470
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   471
function twentyten_posted_on() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   472
	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   473
		'meta-prep meta-prep-author',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   474
		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   475
			get_permalink(),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   476
			esc_attr( get_the_time() ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   477
			get_the_date()
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   478
		),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   479
		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   480
			get_author_posts_url( get_the_author_meta( 'ID' ) ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   481
			esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   482
			get_the_author()
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   483
		)
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   484
	);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   485
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   486
endif;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   487
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   488
if ( ! function_exists( 'twentyten_posted_in' ) ) :
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   489
/**
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   490
 * Prints HTML with meta information for the current post (category, tags and permalink).
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   491
 *
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   492
 * @since Twenty Ten 1.0
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   493
 */
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   494
function twentyten_posted_in() {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   495
	// Retrieves tag list of current post, separated by commas.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   496
	$tag_list = get_the_tag_list( '', ', ' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   497
	if ( $tag_list ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   498
		$posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   499
	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   500
		$posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   501
	} else {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   502
		$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   503
	}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   504
	// Prints the string, replacing the placeholders.
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   505
	printf(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   506
		$posted_in,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   507
		get_the_category_list( ', ' ),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   508
		$tag_list,
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   509
		get_permalink(),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   510
		the_title_attribute( 'echo=0' )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   511
	);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   512
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
   513
endif;