__( 'Primary Menu', 'premier' ),
) );
/**
* Add support for post thumbnails
*/
add_theme_support('post-thumbnails');
add_image_size( 100, 300, true);
add_image_size( 'recent', 700, 400, true );
/**
* Add support for the Aside Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', ) );
// Display Title in theme
add_theme_support( 'title-tag' );
// Add WooCommerce Support
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
// link a custom stylesheet file to the TinyMCE visual editor
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Open+Sans' );
add_editor_style( array('style.css', 'css/editor-style.css', $font_url) );
}
endif; // premier_setup
add_action( 'after_setup_theme', 'premier_setup' );
/**
* Setup the WordPress core custom background feature.
*
* Use add_theme_support to register support for WordPress 3.4+
* as well as provide backward compatibility for previous versions.
* Use feature detection of wp_get_theme() which was introduced
* in WordPress 3.4.
*
* Hooks into the after_setup_theme action.
*
* @since premier 1.0
*/
function premier_register_custom_background() {
$args = array(
'default-color' => 'EEE',
);
$args = apply_filters( 'premier_custom_background_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-background', $args );
} else {
define( $args['default-color'] );
define( $args['default-image'] );
add_theme_support( 'custom-background', $args );
}
}
add_action( 'after_setup_theme', 'premier_register_custom_background' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since premier 1.0
*/
function premier_widgets_init() {
register_sidebar( array(
'name' => __( 'Primary Sidebar', 'premier' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'WooCommerce Sidebar', 'premier' ),
'id' => 'woocommerce_sidebar',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Secondary Sidebar', 'premier' ),
'id' => 'sidebar-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Left Sidebar', 'premier' ),
'id' => 'sidebar-3',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar(array(
'name' => 'Left Footer Column',
'id' => 'left_column',
'description' => __( 'Widget area for footer left column', 'premier' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'name' => 'Center Footer Column',
'id' => 'center_column',
'description' => __( 'Widget area for footer center column', 'premier' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'name' => 'Right Footer Column',
'id' => 'right_column',
'description' => __( 'Widget area for footer right column', 'premier' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
}
add_action( 'widgets_init', 'premier_widgets_init' );
/**
* Enqueue scripts and styles
*/
function premier_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri(), '', '1.4' );
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', '', '4.3.0');
wp_enqueue_style('animate', get_template_directory_uri().'/css/animate.min.css', '', '1.4');
wp_enqueue_style('flexslider', get_template_directory_uri().'/js/flexslider.css', '', '2.0');
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '1.4', true );
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '1.2' );
wp_enqueue_script( 'smoothup', get_template_directory_uri() . '/js/smoothscroll.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'inview', get_template_directory_uri() . '/js/Inview.js', array('jquery'));
wp_enqueue_script( 'theme-js', get_template_directory_uri() . '/js/animate.js', array('jquery', 'inview'));
wp_enqueue_script('flexslider', get_template_directory_uri().'/js/jquery.flexslider-min.js', array('jquery'));
wp_enqueue_script('flexslider-init', get_template_directory_uri().'/js/flexslider-init.js', array('jquery', 'flexslider'));
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'premier_scripts' );
/**
* Implement excerpt for homepage slider
*/
function premier_get_slider_excerpt(){
$excerpt = get_the_content();
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 120);
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
return $excerpt;
}
// Theme Options
include('functions/customizer_controller.php');
include('functions/customizer_settings.php');
include('functions/customizer_styles.php');
/**
* Implement excerpt for homepage thumbnails
*/
function premier_content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
/**
* Custom "more" link format
*/
function premier_new_excerpt_more($more) {
global $post;
return '...';
}
add_filter('excerpt_more', 'premier_new_excerpt_more');
/**
* Implement the Custom Header feature
*/
add_theme_support( 'custom-header' );
function premier_custom_header_setup() {
$args = array(
'default-image' => '',
'default-text-color' => '222',
'width' => 1170,
'height' => 400,
'flex-height' => true,
'wp-head-callback' => 'premier_header_style',
'admin-head-callback' => 'premier_admin_header_style',
'admin-preview-callback' => 'premier_admin_header_image',
);
$args = apply_filters( 'premier_custom_header_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-header', $args );
}
}
add_action( 'after_setup_theme', 'premier_custom_header_setup' );
if ( ! function_exists( 'premier_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
*
* @see premier_custom_header_setup().
*
* @since premier 1.0
*/
function premier_header_style() {
// If no custom options for text are set, let's bail
// If we get this far, we have custom styles. Let's do this.
?>
Header admin panel.
*
* @see premier_custom_header_setup().
*
* @since premier 1.0
*/
function premier_admin_header_style() {
?>
Header admin panel.
*
* @see premier_custom_header_setup().
*
* @since premier 1.0
*/
function premier_admin_header_image() { ?>
>
$section)
{
if(get_theme_mod($array_font_sections[$id].'_display'))
{
$family = get_theme_mod($array_font_sections[$id]);
$fonts = $family;
$fonts = ltrim($fonts, '|');
$url = add_query_arg('family', urlencode($fonts), "//fonts.googleapis.com/css" );
wp_enqueue_style('premier-google-fonts-'.urlencode($fonts), $url);
$enqueueFonts++;
}
}
if($enqueueFonts == 0){
return;
}
}
add_action('wp_enqueue_scripts', 'premier_google_fonts');
/* Query WooCommerce activation */
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
function is_woocommerce_activated() {
return class_exists( 'woocommerce' ) ? true : false;
}
}
/* Get woocommerce custom theme code */
if ( is_woocommerce_activated() ) {
require get_template_directory() . '/inc/woocommerce/hooks.php';
function premier_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
cart->cart_contents_count, 'premier'), $woocommerce->cart->cart_contents_count);?> - cart->get_cart_total(); ?>