* 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 '' : ?>
  • id="li-comment-">
    says:', TTW_TRANS ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  • $name, 'id' => $id, 'description' => $desc, 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } function weaver_widgets_init() { // Area 1, located at the top of the sidebar. wvr_register_sidebar(__( 'Primary Widget Area', TTW_TRANS ), 'primary-widget-area', __( 'The primary widget area', TTW_TRANS )); // Area 2, located below the Primary Widget Area in the sidebar. Empty by default. wvr_register_sidebar(__( 'Secondary Widget Area', TTW_TRANS ), 'secondary-widget-area', __( 'The secondary widget area', TTW_TRANS )); ## alternative widget area wvr_register_sidebar(__( 'Weaver Alternative Widget Area', TTW_TRANS ), 'alternative-widget-area', __( 'An alternative widget area used only by the Alternative Left and Right page templates.', TTW_TRANS )); ## top widget area wvr_register_sidebar(__( 'Top Widget Area', TTW_TRANS ), 'top-widget-area', __( 'The top widget area appears above the content area, including the main blog page. It is not displayed on special post pages (archives, etc.).', TTW_TRANS )); ## bottom widget area wvr_register_sidebar(__( 'Bottom Widget Area', TTW_TRANS ), 'bottom-widget-area', __( 'The bottom widget area appears below the content area. It is not displayed on special post pages.', TTW_TRANS )); ## Site-wide top area wvr_register_sidebar(__( 'Sitewide Top Widget Area', TTW_TRANS ), 'sitewide-top-widget-area', __( 'This widget area appears at the top of all site static pages and post pages (including special post pages) EXCEPT pages using the blank or iframe page templates.', TTW_TRANS )); ## Site-wide bottom area wvr_register_sidebar(__( 'Sitewide Bottom Widget Area', TTW_TRANS ), 'sitewide-bottom-widget-area', __( 'This widget area appears at the bottom of all site static pages and post pages (including special post pages) EXCEPT pages using the blank or iframe page templates.', TTW_TRANS )); ## Special Post Pages Top Widget area wvr_register_sidebar(__( 'Post Pages Top Widget Area', TTW_TRANS ), 'postpages-widget-area', __( 'This widget area will appear at the top of special post pages (archives, attachment, author, category, single post) This is not used on the main blog page.', TTW_TRANS )); ## header widget area wvr_register_sidebar( __( 'Header Widget Area', TTW_TRANS ), 'header-widget-area', __( "The header widget area appears at the top of the page. It is intended for more advanced web pages, and is designed primarily to use Text Widgets to show social feeds or other custom items. Styling is via '#ttw-head-widget', '#ttw-head-widget .textwidget', and inline span style rules. Unless you add widgets, it doesn't show.", TTW_TRANS )); // Area 3, located in the footer. Empty by default. wvr_register_sidebar( __( 'First Footer Widget Area', TTW_TRANS ), 'first-footer-widget-area', __( 'The first footer widget area', TTW_TRANS )); // Area 4, located in the footer. Empty by default. wvr_register_sidebar(__( 'Second Footer Widget Area', TTW_TRANS ), 'second-footer-widget-area', __( 'The second footer widget area', TTW_TRANS )); // Area 5, located in the footer. Empty by default. wvr_register_sidebar(__( 'Third Footer Widget Area', TTW_TRANS ), 'third-footer-widget-area', __( 'The third footer widget area', TTW_TRANS )); // Area 6, located in the footer. Empty by default. wvr_register_sidebar( __( 'Fourth Footer Widget Area', TTW_TRANS ), 'fourth-footer-widget-area', __( 'The fourth footer widget area', TTW_TRANS )); $extra_areas = ttw_getadminopt('ttw_perpagewidgets'); // create extra areas? if (strlen($extra_areas) > 0) { $extra_list = explode(',', $extra_areas); foreach ($extra_list as $area) { wvr_register_sidebar( __('Per Page Area ') . $area, 'per-page-'.$area, __('This widget can serve as an additional Top area, or as a Primary or Secondary area replacement when you add its name "') . $area . __('" to individual pages from the "Weaver Options For This Page" box. You can style it using: ') . '".per-page-' . $area .'".' ); } } } /** Register sidebars by running weaver_widgets_init() on the widgets_init hook. */ add_action( 'widgets_init', 'weaver_widgets_init' ); /** * Removes the default styles that are packaged with the Recent Comments widget. * * To override this in a child theme, remove the filter and optionally add your own * function tied to the widgets_init action hook. * * @since Twenty Ten 1.0 */ function weaver_remove_recent_comments_style() { if (false /* USE_WP_3_1 */) { add_filter( 'show_recent_comments_widget_style', '__return_false' ); } else { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } } add_action( 'widgets_init', 'weaver_remove_recent_comments_style' ); if ( ! function_exists( 'weaver_post_title' ) ) { // display the post title function weaver_post_title($is_single = false) { if (!$is_single && ttw_is_checked_post_opt('ttw-favorite-post')) { printf(sprintf("", get_template_directory_uri())); } ?>
    \n"; $by_img = ""; if (ttw_getopt('ttw_post_icons')) { if (!ttw_getopt('ttw_post_hide_date')) printf(sprintf('', get_template_directory_uri())); if (!ttw_getopt('ttw_post_hide_author')) $by_img = sprintf('', get_template_directory_uri(),$leftm); } if (!ttw_getopt('ttw_post_hide_date')) { $msg = __( 'Posted on %2$s by %3$s', TTW_TRANS ); if (ttw_getopt('ttw_post_hide_author')) $msg = __( 'Posted on %2$s %3$s', TTW_TRANS ); printf( $msg, 'meta-prep meta-prep-author', sprintf( '%3$s', get_permalink(), esc_attr( get_the_time() ), get_the_date() ),$by_img); } else { if (!empty($by_img)) echo $by_img; } if (!ttw_getopt('ttw_post_hide_author')) { printf( sprintf( '%3$s', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', TTW_TRANS ), get_the_author() ), get_the_author() )); } echo $extra_info . "\n \n"; } endif; if ( ! function_exists( 'weaver_posted_in' ) ) : /** * Prints HTML with meta information for the current post (category, tags and permalink). */ function weaver_posted_in() { // display the standard cat/tag/comments line global $ttw_cur_post_id; $leftm = '8'; if (!ttw_getopt('ttw_hide_post_fill')) $leftm = '0'; // no left margin if not hiding fill in echo("
    \n"); $need_sep = false; $cat_count = count( get_the_category() ); if ( ($cat_count > 1 || ($cat_count < 2 && !ttw_getopt('ttw_hide_singleton_cat'))) && !ttw_getopt('ttw_post_hide_cats') ) { if (ttw_getopt('ttw_post_icons')) { printf(sprintf('', get_template_directory_uri())); } ?> Posted in %2$s', TTW_TRANS ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> | ', get_template_directory_uri())); } ?> Tagged %2$s', TTW_TRANS ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> 0 || 'open' == $post->comment_status) { if ($need_sep) { ?> | ', get_template_directory_uri())); } ?> | ', '' ); echo("
    \n"); } endif; if ( ! function_exists( 'weaver_posted_in_single' ) ) : /** * Prints HTML with meta information for the current post (category, tags and permalink). * * @since Twenty Ten 1.0 */ function weaver_posted_in_single() { // Retrieves tag list of current post, separated by commas. $tag_list = get_the_tag_list( '', ', ' ); if ( $tag_list && !ttw_getopt('ttw_post_hide_cats')) { if (!ttw_getopt('ttw_post_icons')) { $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', TTW_TRANS ); } else { $posted_in = sprintf('', get_template_directory_uri()) . '%1$s' . sprintf('', get_template_directory_uri()) . '%2$s' . sprintf('', get_template_directory_uri()) . 'Permalink'; } } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) && !ttw_getopt('ttw_post_hide_cats')) { if (!ttw_getopt('ttw_post_icons')) { $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', TTW_TRANS ); } else { $posted_in = sprintf('', get_template_directory_uri()) . '%1$s' . sprintf('', get_template_directory_uri()) . 'Permalink'; } } else { if (!ttw_getopt('ttw_post_icons')) { $posted_in = __( 'Bookmark the permalink.', TTW_TRANS ); } else { $posted_in = sprintf('', get_template_directory_uri()) . 'Permalink'; } } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( ', ' ), $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); edit_post_link( __( 'Edit', TTW_TRANS ), ' ', '' ); } endif; // New stuff for Weaver function ttw_put_ttw_widgetarea($area,$style,$pagetype = false) { // emit ttw widget area depending on various settings (for page.php and index.php) if (ttw_is_checked_page_opt($area)) return; // hide area option checked. $showwidg = !ttw_getopt($pagetype); if (is_front_page() && ttw_getopt('ttw_force_widg_frontpage')) $showwidg = true; if ($showwidg && is_active_sidebar($area)) { /* add top and bottom widget areas */ ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */ $success = dynamic_sidebar($area); $content = ob_get_clean(); if ($success) { ?>
    class="widget-area" role="complementary" >