for posts and comments.
add_theme_support( 'automatic-feed-links' );
// This theme supports a variety of post formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'bre-bootstrap-ecommerce' ) );
// This theme uses extra menus wp_nav_menu() in one location.
register_nav_menu( 'secondary-menu', __( 'Secondary Menu', 'bre-bootstrap-ecommerce' ) );
/*
* This theme supports custom background color and image, and here
* we also set up the default background color.
*/
add_theme_support( 'custom-background', array(
'default-color' => 'D7EDFB',
'default-image' => get_template_directory_uri() . '/images/background.jpg',
) );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 870, 9999 );
add_image_size( '150cropped', 150, 150, true );
add_image_size( '270cropped', 270, 270, true );
add_image_size( 'height90', 9999, 90 ); /* 120x90 4:3 */
add_image_size( 'height135', 9999, 135 ); /* 180x135 4:3 */
add_image_size( 'height195', 9999, 192 ); /* 256x192 4:3 */
add_image_size( 'height270', 9999, 270 ); /* 360x270 4:3 */
add_image_size( 'height360', 9999, 360 ); /* 440x360 4:3 */
/* buddypress support */
// This theme comes with all the BuddyPress goodies
add_theme_support( 'buddypress' );
// excerpt support for pages
add_post_type_support( 'page', 'excerpt' );
}
add_action( 'after_setup_theme', 'bre_setup' );
/**
* Filter callback to add image sizes to Media Uploader
*
* WP 3.3 beta adds a new filter 'image_size_names_choose' to
* the list of image sizes which are displayed in the Media Uploader
* after an image has been uploaded.
*
* See image_size_input_fields() in wp-admin/includes/media.php
*
*
* @uses get_intermediate_image_sizes()
*
* @param $sizes, array of default image sizes (associative array)
* @return $new_sizes, array of all image sizes (associative array)
*/
function bre_display_image_size_names_muploader( $sizes ) {
$new_sizes = array();
$added_sizes = get_intermediate_image_sizes();
// $added_sizes is an indexed array, therefore need to convert it
// to associative array, using $value for $key and $value
foreach( $added_sizes as $key => $value) {
$new_sizes[$value] = $value;
}
// This preserves the labels in $sizes, and merges the two arrays
$new_sizes = array_merge( $new_sizes, $sizes );
return $new_sizes;
}
add_filter('image_size_names_choose', 'bre_display_image_size_names_muploader', 11, 1);
/**
* Adds support for a custom header image.
*/
require( get_template_directory() . '/inc/custom-header.php' );
/**
* Enqueues scripts and styles for front-end.
*
* @since Bootstrap eCommerce 1.0
*/
function bre_scripts_styles() {
global $wp_styles;
// Loads Bootstrap CSS
wp_register_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', null, null, null);
wp_enqueue_style('bootstrap');
// Loads TheCartPress loop CSS
wp_register_style( 'tcp-loop', get_template_directory_uri() . '/css/tcp_loop.css');
wp_enqueue_style('tcp-loop');
/*
* Loads our main stylesheet.
*/
wp_enqueue_style( 'bre-style', get_stylesheet_uri() );
/*
* Loads the Internet Explorer specific stylesheet.
*/
wp_enqueue_style( 'bre-ie', get_template_directory_uri() . '/css/ie.css', array( 'bre-style' ), '20121010' );
$wp_styles->add_data( 'bre-ie', 'conditional', 'lt IE 9' );
/*
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'jquery' );
wp_enqueue_script('respond', get_template_directory_uri() . '/js/respond.min.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script('tcp-bootstrap', get_template_directory_uri() . '/js/bre-bootstrap.js', array( 'jquery' ), '1.0', true );
/*
* Loads our special font CSS file.
*
* The use of Open Sans by default is localized. For languages that use
* characters not supported by the font, the font can be disabled.
*
* To disable in a child theme, use wp_dequeue_style()
* function mytheme_dequeue_fonts() {
* wp_dequeue_style( 'bre-fonts' );
* }
* add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_fonts', 11 );
*/
/* translators: If there are characters in your language that are not supported
by Open Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'bre-bootstrap-ecommerce' ) ) {
$subsets = 'latin,latin-ext';
/* translators: To add an additional Open Sans character subset specific to your language, translate
this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */
$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'bre-bootstrap-ecommerce' );
if ( 'cyrillic' == $subset )
$subsets .= ',cyrillic,cyrillic-ext';
elseif ( 'greek' == $subset )
$subsets .= ',greek,greek-ext';
elseif ( 'vietnamese' == $subset )
$subsets .= ',vietnamese';
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array(
'family' => 'Open+Sans:400italic,700italic,400,600,700',
'subset' => $subsets,
);
wp_enqueue_style( 'bre-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null );
}
}
add_action( 'wp_enqueue_scripts', 'bre_scripts_styles' );
function bre_wp_footer() {
$tcp_bse_sidebar_style = get_option( 'tcp_bse_sidebar_style', false );
$tcp_bse_layout = get_option( 'tcp_bse_layout', 'content-sidebar' );
?>
= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'bre-bootstrap-ecommerce' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'bre_wp_title', 10, 2 );
/**
* Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link.
*
* @since Bootstrap eCommerce 1.0
*/
function bre_page_menu_args( $args ) {
if ( ! isset( $args['show_home'] ) )
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'bre_page_menu_args' );
/**
* Registers our main widget area and the front page widget areas.
*
* @since Bootstrap eCommerce 1.0
*/
function bre_widgets_init() {
register_sidebar( array(
'name' => __( 'Store/Site Sidebar', 'bre-bootstrap-ecommerce' ),
'id' => 'sidebar-1',
'description' => __( 'Appears on Store pages', 'bre-bootstrap-ecommerce' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'bre-bootstrap-ecommerce' ),
'id' => 'sidebar-blog',
'description' => __( 'Appears in blog templates: archive, single, category and author templates', 'bre-bootstrap-ecommerce' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Cross Sales/Content Sidebar', 'bre-bootstrap-ecommerce' ),
'id' => 'sidebar-cross',
'description' => __( 'Appears after the content in single, category, single-product and taxonomy templates (blog and store). Cross sales and cross content !', 'bre-bootstrap-ecommerce' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Horizontal Layered Navigation support', 'bre-bootstrap-ecommerce' ),
'id' => 'sidebar-layered',
'description' => __( 'Add support for horizontal layered navigation. Appears before the loop in taxonomy template. ', 'bre-bootstrap-ecommerce' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __( 'First Front Page Widget Area', 'bre-bootstrap-ecommerce' ),
'id' => 'sidebar-2',
'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'bre-bootstrap-ecommerce' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Second Front Page Widget Area', 'bre-bootstrap-ecommerce' ),
'id' => 'sidebar-3',
'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'bre-bootstrap-ecommerce' ),
'before_widget' => '',
'before_title' => '