'Etoile Theme Companion',
'slug' => 'etoile-theme-companion',
'required' => false,
),
array(
'name' => 'Ultimate Slider',
'slug' => 'ultimate-slider',
'required' => false,
),
array(
'name' => 'Ultimate Product Catalog',
'slug' => 'ultimate-product-catalogue',
'required' => false,
),
);
// Only uncomment the strings in the config array if you want to customize the strings.
$config = array(
'id' => 'ultimate-showcase', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa( $plugins, $config );
}
/*
=====================================================================
Load text domain
=====================================================================
*/
add_action('after_setup_theme', 'upcp_theme_text_domain');
function upcp_theme_text_domain(){
load_theme_textdomain('ultimate-showcase', get_template_directory() . '/lang');
}
/*
=====================================================================
Add customizable navigation
=====================================================================
*/
function upcp_theme_register_my_menu() {
register_nav_menu('main-menu', __('Main Menu', 'ultimate-showcase'));
}
add_action( 'init', 'upcp_theme_register_my_menu' );
/*
=====================================================================
Widgetize sidebar and footer
=====================================================================
*/
function upcp_theme_widgets_init() {
register_sidebar( array(
'name' => __('Page Sidebar', 'ultimate-showcase'),
'id' => 'sidebar_widget',
'before_widget' => '
',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'upcp_theme_widgets_init' );
/*
=====================================================================
Post thumbnails
=====================================================================
*/
add_action( 'after_setup_theme', 'upcp_theme_post_thumbnails' );
function upcp_theme_post_thumbnails(){
add_theme_support('post-thumbnails');
//set_post_thumbnail_size(250, 250, true);
}
/*
=====================================================================
Custom background
=====================================================================
*/
add_action( 'after_setup_theme', 'upcp_theme_custom_background' );
function upcp_theme_custom_background(){
$args = array(
'default-color' => 'ffffff',
);
add_theme_support( 'custom-background', $args );
}
/*
=====================================================================
Feeds
=====================================================================
*/
add_action( 'after_setup_theme', 'upcp_theme_automatic_feed_links' );
function upcp_theme_automatic_feed_links(){
add_theme_support( 'automatic-feed-links' );
}
/*
=====================================================================
Content width
=====================================================================
*/
if ( ! isset( $content_width ) ) $content_width = 960;
/*
=====================================================================
Title tag
=====================================================================
*/
add_action( 'after_setup_theme', 'upcp_theme_slug_setup' );
function upcp_theme_slug_setup(){
add_theme_support( 'title-tag' );
}
/*
=====================================================================
Custom logo
=====================================================================
*/
add_action( 'after_setup_theme', 'upcp_theme_custom_header' );
function upcp_theme_custom_header(){
add_theme_support( "custom-header" );
if ( ! defined('NO_HEADER_TEXT') ){
define( 'NO_HEADER_TEXT', true );
}
}
function upcp_theme_custom_logo() {
add_theme_support( 'custom-logo' );
}
add_action( 'after_setup_theme', 'upcp_theme_custom_logo' );
/*
=====================================================================
Threaded comments
=====================================================================
*/
function upcp_theme_threaded_comments(){
if ( is_singular() && get_option( 'thread_comments' ) ){
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'comment_form_before', 'upcp_theme_threaded_comments' );
/*
=====================================================================
Customizer Stuff
=====================================================================
*/
function upcp_theme_customize_register( $wp_customize ){
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$pluginThemeCompanion = "etoile-theme-companion/etoile-theme-companion.php";
$installedThemeCompanion = is_plugin_active($pluginThemeCompanion);
$pluginUPCP = "ultimate-product-catalogue/UPCP_Main.php";
$installedUPCP = is_plugin_active($pluginUPCP);
$wp_customize->remove_section('background_image');
$wp_customize->get_section('header_image')->title = __( 'Logo', 'ultimate-showcase');
if ( function_exists('the_custom_logo') ){
$wp_customize->remove_section('header_image');
}
// LOGO HEIGHT
$wp_customize->add_setting( 'upcp_theme_setting_logo_height', array(
'default' => '24px',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_logo_height',
array(
'section' => 'title_tagline',
'label' => __( 'Logo Height', 'ultimate-showcase' ),
'description' => __( 'Specify the logo height in pixels (e.g. 24px)', 'ultimate-showcase' ),
'type' => 'text',
)
);
// LOGO TOP MARGIN
$wp_customize->add_setting( 'upcp_theme_setting_logo_top_margin', array(
'default' => '28px',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_logo_top_margin',
array(
'section' => 'title_tagline',
'label' => __( 'Logo Top Margin', 'ultimate-showcase' ),
'description' => __( 'Specify the margin above the logo in pixels (e.g. 28px)', 'ultimate-showcase' ),
'type' => 'text',
)
);
/*==============
START COLOURS
==============*/
// TEXT COLOR
$wp_customize->add_setting( 'upcp_theme_setting_text_color', array(
'default' => '#999',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_text_color',
array(
'label' => __( 'Text Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_text_color'
)
)
);
// LINK COLOR
$wp_customize->add_setting( 'upcp_theme_setting_link_color', array(
'default' => '#34ADCF',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_link_color',
array(
'label' => __( 'Link Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_link_color'
)
)
);
// HEADER BACKGROUND COLOR
$wp_customize->add_setting( 'upcp_theme_setting_header_background_color', array(
'default' => '#fff',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_header_background_color',
array(
'label' => __( 'Header Background Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_header_background_color'
)
)
);
// MENU TEXT COLOR
$wp_customize->add_setting( 'upcp_theme_setting_menu_text_color', array(
'default' => '#111',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_menu_text_color',
array(
'label' => __( 'Menu Text Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_menu_text_color'
)
)
);
// MENU TEXT HOVER COLOR
$wp_customize->add_setting( 'upcp_theme_setting_menu_text_hover_color', array(
'default' => '#34ADCF',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_menu_text_hover_color',
array(
'label' => __( 'Menu Text Hover Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_menu_text_hover_color'
)
)
);
// MENU DROP DOWN BACKGROUND COLOR
$wp_customize->add_setting( 'upcp_theme_setting_menu_dropdown_background_color', array(
'default' => '#111',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_menu_dropdown_background_color',
array(
'label' => __( 'Menu Drop Down Background Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_menu_dropdown_background_color'
)
)
);
// MENU DROP DOWN BACKGROUND HOVER COLOR
$wp_customize->add_setting( 'upcp_theme_setting_menu_dropdown_background_hover_color', array(
'default' => '#fff',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_menu_dropdown_background_hover_color',
array(
'label' => __( 'Menu Drop Down Background Hover Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_menu_dropdown_background_hover_color'
)
)
);
// MENU DROP DOWN TEXT COLOR
$wp_customize->add_setting( 'upcp_theme_setting_menu_dropdown_text_color', array(
'default' => '#fff',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_menu_dropdown_text_color',
array(
'label' => __( 'Menu Drop Down Text Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_menu_dropdown_text_color'
)
)
);
// MENU DROP DOWN TEXT HOVER COLOR
$wp_customize->add_setting( 'upcp_theme_setting_menu_dropdown_text_hover_color', array(
'default' => '#111',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_menu_dropdown_text_hover_color',
array(
'label' => __( 'Menu Drop Down Text Hover Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_menu_dropdown_text_hover_color'
)
)
);
// PAGE TITLE BAR BACKGROUND COLOR
$wp_customize->add_setting( 'upcp_theme_setting_page_title_bar_background_color', array(
'default' => '#34ADCF',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_page_title_bar_background_color',
array(
'label' => __( 'Page Title Bar Background Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_page_title_bar_background_color'
)
)
);
// PAGE TITLE BAR TEXT COLOR
$wp_customize->add_setting( 'upcp_theme_setting_page_title_bar_text_color', array(
'default' => '#fff',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_page_title_bar_text_color',
array(
'label' => __( 'Page Title Bar Text Color', 'ultimate-showcase' ),
'section' => 'colors',
'settings' => 'upcp_theme_setting_page_title_bar_text_color'
)
)
);
/*==============
END COLOURS
==============*/
/*==============
START FONTS
==============*/
// CREATE FONTS SECTION
$wp_customize->add_section(
'upcp_theme_setting_fonts',
array(
'title' => __( 'Fonts', 'ultimate-showcase'),
'description' => __( 'Please note that, if you use a Google font or other webfont, you must also properly include that font (i.e. in the header file, the functions file or via CSS).', 'ultimate-showcase'),
'priority' => 50
)
);
// MAIN BODY FONT
$wp_customize->add_setting( 'upcp_theme_setting_font_main', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_font_main',
array(
'section' => 'upcp_theme_setting_fonts',
'label' => __( 'Main Body Font', 'ultimate-showcase' ),
'type' => 'text',
)
);
// HEADING FONT
$wp_customize->add_setting( 'upcp_theme_setting_font_heading', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_font_heading',
array(
'section' => 'upcp_theme_setting_fonts',
'label' => __( 'Heading Font', 'ultimate-showcase' ),
'type' => 'text',
)
);
// MENU FONT
$wp_customize->add_setting( 'upcp_theme_setting_font_menu', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_font_menu',
array(
'section' => 'upcp_theme_setting_fonts',
'label' => __( 'Menu Font', 'ultimate-showcase' ),
'type' => 'text',
)
);
/*==============
END FONTS
==============*/
/*==============
START CALLOUT
==============*/
if($installedThemeCompanion){
// CREATE CALLOUT SECTION
$wp_customize->add_section(
'upcp_theme_setting_callout_section',
array(
'title' => __( 'Callout Area', 'ultimate-showcase'),
'priority' => 200
)
);
// CALLOUT ENABLE
$wp_customize->add_setting( 'upcp_theme_setting_callout_enable', array(
'default' => 'yes',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_callout_enable',
array(
'section' => 'upcp_theme_setting_callout_section',
'label' => __( 'Display Callout Area on Homepage', 'ultimate-showcase' ),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
// CALLOUT HEADING TEXT
$wp_customize->add_setting( 'upcp_theme_setting_callout_heading_text', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_callout_heading_text',
array(
'section' => 'upcp_theme_setting_callout_section',
'label' => __( 'Heading Text', 'ultimate-showcase' ),
'type' => 'text',
)
);
// CALLOUT SUB-HEADING TEXT
$wp_customize->add_setting( 'upcp_theme_setting_callout_subheading_text', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_callout_subheading_text',
array(
'section' => 'upcp_theme_setting_callout_section',
'label' => __( 'Sub-Heading Text', 'ultimate-showcase' ),
'type' => 'text',
)
);
// CALLOUT BUTTON TEXT
$wp_customize->add_setting( 'upcp_theme_setting_callout_button_text', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_callout_button_text',
array(
'section' => 'upcp_theme_setting_callout_section',
'label' => __( 'Button Text', 'ultimate-showcase' ),
'type' => 'text',
)
);
// CALLOUT BUTTON LINK
$wp_customize->add_setting( 'upcp_theme_setting_callout_button_link', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_url_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_callout_button_link',
array(
'section' => 'upcp_theme_setting_callout_section',
'label' => __( 'Button Link', 'ultimate-showcase' ),
'type' => 'text',
)
);
// CALLOUT BACKGROUND COLOR
$wp_customize->add_setting( 'upcp_theme_setting_callout_background_color', array(
'default' => '#34ADCF',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_callout_background_color',
array(
'label' => __( 'Background Color', 'ultimate-showcase' ),
'section' => 'upcp_theme_setting_callout_section',
'settings' => 'upcp_theme_setting_callout_background_color'
)
)
);
// CALLOUT TEXT COLOR
$wp_customize->add_setting( 'upcp_theme_setting_callout_text_color', array(
'default' => '#fff',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_callout_text_color',
array(
'label' => __( 'Text Color', 'ultimate-showcase' ),
'section' => 'upcp_theme_setting_callout_section',
'settings' => 'upcp_theme_setting_callout_text_color'
)
)
);
} //if theme companion active
/*==============
END CALLOUT
==============*/
/*==============
START TEXT ON PIC
==============*/
if($installedThemeCompanion){
// CREATE TEXT ON PIC SECTION
$wp_customize->add_section(
'upcp_theme_setting_textonpic_section',
array(
'title' => __( 'Text on Picture', 'ultimate-showcase'),
'priority' => 200
)
);
// TEXT ON PIC ENABLE
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_enable', array(
'default' => 'yes',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_textonpic_enable',
array(
'section' => 'upcp_theme_setting_textonpic_section',
'label' => __( 'Display Text-on-Picture Area on Homepage', 'ultimate-showcase' ),
'description' => __('Should the text overlay on a background image area be displayed?', 'ultimate-showcase'),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
// TEXT ON PIC HEADING TEXT
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_heading_text', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_textonpic_heading_text',
array(
'section' => 'upcp_theme_setting_textonpic_section',
'label' => __( 'Heading Text', 'ultimate-showcase' ),
'type' => 'text',
)
);
// TEXT ON PIC SUB-HEADING TEXT
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_subheading_text', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_textonpic_subheading_text',
array(
'section' => 'upcp_theme_setting_textonpic_section',
'label' => __( 'Sub-Heading Text', 'ultimate-showcase' ),
'type' => 'text',
)
);
// TEXT ON PIC BUTTON TEXT
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_button_text', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_text_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_textonpic_button_text',
array(
'section' => 'upcp_theme_setting_textonpic_section',
'label' => __( 'Button Text', 'ultimate-showcase' ),
'type' => 'text',
)
);
// TEXT ON PIC BUTTON LINK
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_button_link', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_url_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_textonpic_button_link',
array(
'section' => 'upcp_theme_setting_textonpic_section',
'label' => __( 'Button Link', 'ultimate-showcase' ),
'type' => 'text',
)
);
// TEXT ON PIC TEXT COLOR
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_text_color', array(
'default' => '#fff',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_color_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'upcp_theme_setting_textonpic_text_color',
array(
'label' => __( 'Text Color', 'ultimate-showcase' ),
'section' => 'upcp_theme_setting_textonpic_section',
'settings' => 'upcp_theme_setting_textonpic_text_color'
)
)
);
// TEXT ON PIC TEXT BACKGROUND IMAGE
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_background_image', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_url_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'upcp_theme_setting_textonpic_background_image',
array(
'label' => __( 'Background Image', 'ultimate-showcase' ),
'section' => 'upcp_theme_setting_textonpic_section',
'settings' => 'upcp_theme_setting_textonpic_background_image',
)
)
);
// TEXT ON PIC TEXT OVERLAY IMAGE
$wp_customize->add_setting( 'upcp_theme_setting_textonpic_overlay_image', array(
'default' => '',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_url_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'upcp_theme_setting_textonpic_overlay_image',
array(
'label' => __( 'Overlay Image', 'ultimate-showcase' ),
'section' => 'upcp_theme_setting_textonpic_section',
'settings' => 'upcp_theme_setting_textonpic_overlay_image',
)
)
);
} //if theme companion active
/*==============
END TEXT ON PIC
==============*/
/*==============
START HOMEPAGE GENERAL
==============*/
if($installedThemeCompanion){
// CREATE HOMEPAGE GENERAL SECTION
$wp_customize->add_section(
'upcp_theme_setting_homepage_section',
array(
'title' => __( 'Homepage General', 'ultimate-showcase'),
'description' => __( 'The options to enable the Callout and Text-on-Picture areas can be found in the "Callout Area" and "Text on Picture" sections just below.', 'ultimate-showcase'),
'priority' => 199
)
);
// SLIDER ENABLE
$wp_customize->add_setting( 'upcp_theme_setting_homepage_slider_enable', array(
'default' => 'yes',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_homepage_slider_enable',
array(
'section' => 'upcp_theme_setting_homepage_section',
'label' => __( 'Display Slider', 'ultimate-showcase' ),
'description' => __( 'Should the slider be displayed on the homepage?', 'ultimate-showcase' ),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
// SLIDER STATIC FIRST SLIDE
$wp_customize->add_setting( 'upcp_theme_setting_homepage_slider_static_first', array(
'default' => 'no',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_homepage_slider_static_first',
array(
'section' => 'upcp_theme_setting_homepage_section',
'label' => __( 'Display Static First Slide Only', 'ultimate-showcase' ),
'description' => __( 'Select this option to display your first slide as a static image, with no sliding or animation.', 'ultimate-showcase' ),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
// JUMP BOXES ENABLE
$wp_customize->add_setting( 'upcp_theme_setting_homepage_jumpboxes_enable', array(
'default' => 'yes',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_homepage_jumpboxes_enable',
array(
'section' => 'upcp_theme_setting_homepage_section',
'label' => __( 'Display Jump Boxes', 'ultimate-showcase' ),
'description' => __( 'Should the jump boxes be displayed on the homepage?', 'ultimate-showcase' ),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
// TESTIMONIALS ENABLE
$wp_customize->add_setting( 'upcp_theme_setting_homepage_testimonials_enable', array(
'default' => 'yes',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_homepage_testimonials_enable',
array(
'section' => 'upcp_theme_setting_homepage_section',
'label' => __( 'Display Testimonials', 'ultimate-showcase' ),
'description' => __( 'Should the testimonials be displayed on the homepage?', 'ultimate-showcase' ),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
// FEATURED PRODUCTS ENABLE
$wp_customize->add_setting( 'upcp_theme_setting_homepage_featured_enable', array(
'default' => 'yes',
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_radio_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_homepage_featured_enable',
array(
'section' => 'upcp_theme_setting_homepage_section',
'label' => __( 'Display Featured Products', 'ultimate-showcase' ),
'description' => __( 'Should featured products be displayed on the homepage?', 'ultimate-showcase' ),
'type' => 'radio',
'choices' => array(
'yes' => __( 'Yes', 'ultimate-showcase' ),
'no' => __( 'No', 'ultimate-showcase' ),
)
)
);
} //if theme companion active
/*==============
END HOMEPAGE GENERAL
==============*/
/*==============
START CATALOG URL
==============*/
if($installedUPCP){
// CREATE CATALOG URL SECTION
$wp_customize->add_section(
'upcp_theme_setting_catalog_url',
array(
'title' => __( 'Catalogue URL', 'ultimate-showcase'),
'priority' => 1
)
);
// CATALOG URL TEXT
$wp_customize->add_setting( 'upcp_theme_setting_catalog_url_text', array(
'default' => get_option('EWD_UPCP_Theme_Catalogue_Page_ID'),
'sanitize_callback' => 'upcp_theme_setting_sanitize_all_url_fields',
'transport' => 'refresh',
) );
$wp_customize->add_control(
'upcp_theme_setting_catalog_url_text',
array(
'section' => 'upcp_theme_setting_catalog_url',
'label' => __( 'Catalogue URL', 'ultimate-showcase' ),
'description' => __( 'Input here the URL of the page on which you\'ve placed the [product-catalogue id="X"] shortcode. This will ensure correct functionality of the catalogue-specific features.', 'ultimate-showcase' ),
'type' => 'text',
)
);
} //if is active UPCP
/*==============
END CATALOG URL
==============*/
} // END upcp_theme_customize_register FUNCTION
add_action( 'customize_register', 'upcp_theme_customize_register' );
function upcp_theme_customizer_css(){
$fontMain = get_theme_mod( 'upcp_theme_setting_font_main', '' );
$fontHeadings = get_theme_mod( 'upcp_theme_setting_font_heading', '' );
$fontMenu = get_theme_mod( 'upcp_theme_setting_font_menu', '' );
echo "";
}
add_action( 'wp_head', 'upcp_theme_customizer_css' );
function upcp_theme_setting_sanitize_all_text_fields($input){
return sanitize_text_field($input);
}
function upcp_theme_setting_sanitize_all_textarea_fields($input){
return sanitize_textarea_field($input);
}
function upcp_theme_setting_sanitize_all_color_fields($input){
return sanitize_hex_color($input);
}
function upcp_theme_setting_sanitize_all_url_fields($input){
return esc_url_raw($input);
}
function upcp_theme_setting_sanitize_all_radio_fields($input, $setting){
$input = sanitize_key($input);
$choices = $setting->manager->get_control($setting->id)->choices;
return ( array_key_exists($input, $choices) ? $input : $setting->default );
}
/*
=====================================================================
Excerpt Read More link
=====================================================================
*/
function upcp_theme_excerpt_read_more($more) {
global $post;
return '
' . __('Read More', 'ultimate-showcase') . '';
}
add_filter('excerpt_more', 'upcp_theme_excerpt_read_more');
/*
=====================================================================
WooCommerce
=====================================================================
*/
//Declare support
add_action( 'after_setup_theme', 'upcp_theme_woocommerce_support' );
function upcp_theme_woocommerce_support() {
add_theme_support( 'woocommerce' );
}