* add_action( 'after_setup_theme', 'my_child_theme_setup' ); * function my_child_theme_setup() { * // We are providing our own filter for excerpt_length (or using the unfiltered value) * remove_filter( 'excerpt_length', 'weaver_excerpt_length' ); * ... * } * * * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */ /** * Set the content width based on the theme's design and stylesheet. * * Used to set the width of images and content. Should be equal to the width the theme * is designed for, generally via the style.css stylesheet. */ define ('TTW_THEMEWIDTH','940'); if ( ! isset( $content_width ) ) $content_width = 640; /** Tell WordPress to run weaver_setup() when the 'after_setup_theme' hook is run. */ add_action( 'after_setup_theme', 'weaver_setup' ); if ( ! function_exists( 'weaver_setup' ) ): /** * 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 * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * To override weaver_setup() in a child theme, add your own weaver_setup to your child theme's * functions.php file. * * @uses add_theme_support() To add support for post thumbnails and automatic feed links. * @uses register_nav_menus() To add support for navigation menus. * @uses add_custom_background() To add support for a custom background. * @uses add_editor_style() To style the visual editor. * @uses load_theme_textdomain() For translation/localization support. * @uses add_custom_image_header() To add support for a custom header. * @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. * */ function weaver_setup() { // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // Post Format support. add_theme_support( 'post-formats', array( 'gallery' ) ); // This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); // Add default posts and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); // Make theme available for translation // Translations can be filed in the /languages/ directory load_theme_textdomain( TTW_TRANS, TEMPLATEPATH . '/languages' ); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); // Weaver supports two nav menus register_nav_menus( array( 'primary' => __( 'Primary Navigation', TTW_TRANS ), 'secondary' => __( 'Secondary Navigation', TTW_TRANS ), ) ); // This theme allows users to set a custom background add_custom_background(); // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'wheat' => array ( 'url' => "%s/images/headers/wheat.jpg", 'thumbnail_url' => "%s/images/headers/wheat-thumbnail.jpg", 'description' => __( 'Wheat 940x198 Header', TTW_TRANS ) ), 'buds' => array( 'url' => '%s/images/headers/buds.jpg', 'thumbnail_url' => '%s/images/headers/buds-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Buds', TTW_TRANS ) ), 'grand-teton' => array( 'url' => '%s/images/headers/grand-teton.jpg', 'thumbnail_url' => '%s/images/headers/grand-teton-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Grand Tetons', TTW_TRANS ) ), 'moon' => array( 'url' => '%s/images/headers/moon.jpg', 'thumbnail_url' => '%s/images/headers/moon-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Moon', TTW_TRANS ) ), 'moss' => array( 'url' => '%s/images/headers/moss.jpg', 'thumbnail_url' => '%s/images/headers/moss-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Moss', TTW_TRANS ) ), 'mum' => array ( 'url' => "%s/images/headers/mum.jpg", 'thumbnail_url' => "%s/images/headers/mum-thumbnail.jpg", 'description' => __( 'Mum 940x198 Header', TTW_TRANS ) ), 'ocean-birds' => array( 'url' => '%s/images/headers/ocean-birds.jpg', 'thumbnail_url' => '%s/images/headers/ocean-birds-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Ocean Birds', TTW_TRANS ) ), 'painted-desert' => array( 'url' => '%s/images/headers/painted-desert.jpg', 'thumbnail_url' => '%s/images/headers/painted-desert-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Painted Desert', TTW_TRANS ) ), 'path' => array( 'url' => '%s/images/headers/path.jpg', 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Path', TTW_TRANS ) ), 'sopris' => array ( 'url' => "%s/images/headers/sopris.png", 'thumbnail_url' => "%s/images/headers/sopris-thumbnail.png", 'description' => __( 'Sopris 940x198 Header', TTW_TRANS ) ), 'sunset' => array( 'url' => '%s/images/headers/sunset.jpg', 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Sunset', TTW_TRANS ) ), 'wpweaver' => array ( 'url' => "%s/images/headers/wpweaver.jpg", 'thumbnail_url' => "%s/images/headers/wpweaver-thumbnail.jpg", 'description' => __( 'WPWeaver 940x140 Header', TTW_TRANS ) ), 'yosemite' => array( 'url' => '%s/images/headers/yosemite.jpg', 'thumbnail_url' => '%s/images/headers/yosemite-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Yosemite', TTW_TRANS ) ), 'indieave' => array ( 'url' => "%s/images/headers/indieave.png", 'thumbnail_url' => "%s/images/headers/indieave-thumbnail.png", 'description' => __( 'Indie Ave 940x180 Blank Header BG', TTW_TRANS ) ), 'ivorydrive' => array ( 'url' => "%s/images/headers/ivorydrive.png", 'thumbnail_url' => "%s/images/headers/ivorydrive-thumbnail.png", 'description' => __( 'Ivory Drive 940x198 Blank Header BG', TTW_TRANS ) ), 'transparent' => array( 'url' => '%s/images/headers/transparent.png', 'thumbnail_url' => '%s/images/headers/transparent-thumbnail.png', /* translators: header image description */ 'description' => __( 'Transparent header image', TTW_TRANS ) ), 'black' => array( 'url' => '%s/images/headers/black.png', 'thumbnail_url' => '%s/images/headers/black-thumbnail.png', /* translators: header image description */ 'description' => __( 'Black', TTW_TRANS ) ), 'gray' => array( 'url' => '%s/images/headers/gray.png', 'thumbnail_url' => '%s/images/headers/gray-thumbnail.png', /* translators: header image description */ 'description' => __( 'Gray', TTW_TRANS ) ), 'silver' => array( 'url' => '%s/images/headers/silver.png', 'thumbnail_url' => '%s/images/headers/silver-thumbnail.png', /* translators: header image description */ 'description' => __( 'Silver', TTW_TRANS ) ), 'white' => array( 'url' => '%s/images/headers/white.png', 'thumbnail_url' => '%s/images/headers/white-thumbnail.png', /* translators: header image description */ 'description' => __( 'White', TTW_TRANS ) ), 'maroon' => array( 'url' => '%s/images/headers/maroon.png', 'thumbnail_url' => '%s/images/headers/maroon-thumbnail.png', /* translators: header image description */ 'description' => __( 'Maroon', TTW_TRANS ) ), 'red' => array( 'url' => '%s/images/headers/red.png', 'thumbnail_url' => '%s/images/headers/red-thumbnail.png', /* translators: header image description */ 'description' => __( 'Red', TTW_TRANS ) ), 'olive' => array( 'url' => '%s/images/headers/olive.png', 'thumbnail_url' => '%s/images/headers/olive-thumbnail.png', /* translators: header image description */ 'description' => __( 'Olive', TTW_TRANS ) ), 'yellow' => array( 'url' => '%s/images/headers/yellow.png', 'thumbnail_url' => '%s/images/headers/yellow-thumbnail.png', /* translators: header image description */ 'description' => __( 'Yellow', TTW_TRANS ) ), 'green' => array( 'url' => '%s/images/headers/green.png', 'thumbnail_url' => '%s/images/headers/green-thumbnail.png', /* translators: header image description */ 'description' => __( 'Green', TTW_TRANS ) ), 'lime' => array( 'url' => '%s/images/headers/lime.png', 'thumbnail_url' => '%s/images/headers/lime-thumbnail.png', /* translators: header image description */ 'description' => __( 'Lime', TTW_TRANS ) ), 'teal' => array( 'url' => '%s/images/headers/teal.png', 'thumbnail_url' => '%s/images/headers/teal-thumbnail.png', /* translators: header image description */ 'description' => __( 'Teal', TTW_TRANS ) ), 'aqua' => array( 'url' => '%s/images/headers/aqua.png', 'thumbnail_url' => '%s/images/headers/aqua-thumbnail.png', /* translators: header image description */ 'description' => __( 'Aqua', TTW_TRANS ) ), 'navy' => array( 'url' => '%s/images/headers/navy.png', 'thumbnail_url' => '%s/images/headers/navy-thumbnail.png', /* translators: header image description */ 'description' => __( 'Navy', TTW_TRANS ) ), 'blue' => array( 'url' => '%s/images/headers/blue.png', 'thumbnail_url' => '%s/images/headers/blue-thumbnail.png', /* translators: header image description */ 'description' => __( 'Blue', TTW_TRANS ) ), 'purple' => array( 'url' => '%s/images/headers/purple.png', 'thumbnail_url' => '%s/images/headers/purple-thumbnail.png', /* translators: header image description */ 'description' => __( 'Purple', TTW_TRANS ) ), 'fuchsia' => array( 'url' => '%s/images/headers/fuchsia.png', 'thumbnail_url' => '%s/images/headers/fuchsia-thumbnail.png', /* translators: header image description */ 'description' => __( 'fuchsia', TTW_TRANS ) ) ) ); // Now, init the Weaver database ttw_initopts(); /* load opts */ do_action('ttwx_extended_setup'); // load weaver extension options do_action('ttwx_themes_setup'); // needs to before get subtheme because might change it $cur_theme = ttw_getopt('ttw_subtheme'); if ($cur_theme == '' && TTW_START_THEME != 'Twenty Ten') { require_once('wvr-includes/wvr-subthemes.php'); // we only need to include this once on first install. st_set_subtheme(TTW_START_THEME); } // Your changeable header business starts here define( 'HEADER_TEXTCOLOR', '' ); // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. define( 'HEADER_IMAGE', '%s/images/headers/wheat.jpg' ); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to weaver_header_image_width and weaver_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'weaver_header_image_width', 940 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'weaver_header_image_height', 198 ) ); // We'll be using post thumbnails for custom header images on posts and pages. // We want them to be 940 pixels wide by 198 pixels tall. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Don't support text inside the header image. define( 'NO_HEADER_TEXT', true ); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See weaver_admin_header_style(), below. add_custom_image_header( '', 'weaver_admin_header_style' ); // ... and thus ends the changeable header business. } endif; if ( ! function_exists( 'weaver_admin_header_style' ) ) : /** * Styles the header image displayed on the Appearance > Header admin panel. * * Referenced via add_custom_image_header() in weaver_setup(). * * @since Twenty Ten 1.0 */ function weaver_admin_header_style() { ?> 0) return $val; return 40; } add_filter( 'excerpt_length', 'weaver_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts */ function weaver_continue_reading_link() { $rep = ttw_getopt('ttw_excerpt_more_msg'); if (!empty($rep)) $msg = $rep; else $msg = __( 'Continue reading ', TTW_TRANS ); return ' ' . $msg . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and weaver_continue_reading_link(). * * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. */ function weaver_auto_excerpt_more( $more ) { if (ttw_getopt('ttw_excerpt_more_msg') == '') return ' …' . weaver_continue_reading_link(); else return weaver_continue_reading_link(); } add_filter( 'excerpt_more', 'weaver_auto_excerpt_more' ); /** * Adds a pretty "Continue Reading" link to custom post excerpts. * * To override this link in a child theme, remove the filter and add your own * function tied to the get_the_excerpt filter hook. */ function weaver_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= weaver_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'weaver_custom_excerpt_more' ); if ( ! function_exists( 'weaver_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own weaver_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. */ function weaver_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
$name, 'id' => $id, 'description' => $desc, 'before_widget' => '