* @copyright Copyright (c) 2013-2015, Nicolas GUILLAUME
* @link http://presscustomizr.com/customizr
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
if ( ! class_exists( 'TC_utils_settings_map' ) ) :
class TC_utils_settings_map {
static $instance;
private $is_wp_version_before_4_0;
public $customizer_map = array();
function __construct () {
self::$instance =& $this;
//declare a private property to check wp version >= 4.0
global $wp_version;
$this -> is_wp_version_before_4_0 = ( ! version_compare( $wp_version, '4.0', '>=' ) ) ? true : false;
}//end of construct
/**
* Defines sections, settings and function of customizer and return and array
* Also used to get the default options array, in this case $get_default = true and we DISABLE the __get_option (=>infinite loop)
*
* @package Customizr
* @since Customizr 3.0
*/
public function tc_get_customizer_map( $get_default = null ) {
if ( ! empty( $this -> customizer_map ) )
return $this -> customizer_map;
//POPULATE THE MAP WITH DEFAULT CUSTOMIZR SETTINGS
add_filter( 'tc_add_panel_map' , array( $this, 'tc_popul_panels_map'));
add_filter( 'tc_remove_section_map' , array( $this, 'tc_popul_remove_section_map'));
//theme switcher's enabled when user opened the customizer from the theme's page
add_filter( 'tc_remove_section_map' , array( $this, 'tc_set_theme_switcher_visibility'));
add_filter( 'tc_add_section_map' , array( $this, 'tc_popul_section_map' ));
//add controls to the map
add_filter( 'tc_add_setting_control_map' , array( $this , 'tc_popul_setting_control_map' ), 10, 2 );
//$this -> tc_populate_setting_control_map();
//FILTER SPECIFIC SETTING-CONTROL MAPS
//ADDS SETTING / CONTROLS TO THE RELEVANT SECTIONS
add_filter( 'tc_social_option_map' , array( $this, 'tc_generates_socials' ));
add_filter( 'tc_front_page_option_map' , array( $this, 'tc_generates_featured_pages' ));
//CACHE THE GLOBAL CUSTOMIZER MAP
$this -> customizer_map = array_merge(
array( 'add_panel' => apply_filters( 'tc_add_panel_map', array() ) ),
array( 'remove_section' => apply_filters( 'tc_remove_section_map', array() ) ),
array( 'add_section' => apply_filters( 'tc_add_section_map', array() ) ),
array( 'add_setting_control' => apply_filters( 'tc_add_setting_control_map', array(), $get_default ) )
);
return apply_filters( 'tc_customizer_map', $this -> customizer_map );
}
/**
* Populate the control map
* hook : 'tc_add_setting_control_map'
* => loops on a callback list, each callback is a section setting group
* @return array()
*
* @package Customizr
* @since Customizr 3.3+
*/
function tc_popul_setting_control_map( $_map, $get_default = null ) {
$_new_map = array();
$_settings_sections = array(
//GLOBAL SETTINGS
'tc_logo_favicon_option_map',
'tc_skin_option_map',
'tc_fonts_option_map',
'tc_social_option_map',
'tc_icons_option_map',
'tc_links_option_map',
'tc_images_option_map',
'tc_responsive_option_map',
'tc_authors_option_map',
'tc_smoothscroll_option_map',
//HEADER
'tc_header_design_option_map',
'tc_navigation_option_map',
//CONTENT
'tc_front_page_option_map',
'tc_layout_option_map',
'tc_comment_option_map',
'tc_breadcrumb_option_map',
'tc_post_metas_option_map',
'tc_post_list_option_map',
'tc_single_post_option_map',
'tc_gallery_option_map',
'tc_paragraph_option_map',
'tc_post_navigation_option_map',
//SIDEBARS
'tc_sidebars_option_map',
//FOOTER
'tc_footer_global_settings_option_map',
//ADVANCED OPTIONS
'tc_custom_css_option_map',
'tc_performance_option_map',
'tc_placeholders_notice_map',
'tc_external_resources_option_map'
);
foreach ( $_settings_sections as $_section_cb ) {
if ( ! method_exists( $this , $_section_cb ) )
continue;
//applies a filter to each section settings map => allows plugins (featured pages for ex.) to add/remove settings
//each section map takes one boolean param : $get_default
$_section_map = apply_filters(
$_section_cb,
call_user_func_array( array( $this, $_section_cb ), array( $get_default ) )
);
if ( ! is_array( $_section_map) )
continue;
$_new_map = array_merge( $_new_map, $_section_map );
}//foreach
return array_merge( $_map, $_new_map );
}
/******************************************************************************************************
*******************************************************************************************************
* PANEL : GLOBAL SETTINGS
*******************************************************************************************************
******************************************************************************************************/
/*-----------------------------------------------------------------------------------------------------
LOGO & FAVICON SECTION
------------------------------------------------------------------------------------------------------*/
function tc_logo_favicon_option_map( $get_default = null ) {
global $wp_version;
return array(
'tc_logo_upload' => array(
'control' => version_compare( $wp_version, '4.3', '>=' ) ? 'TC_Customize_Cropped_Image_Control' : 'TC_Customize_Upload_Control',
'label' => __( 'Logo Upload (supported formats : .jpg, .png, .gif, svg, svgz)' , 'customizr' ),
'title' => __( 'LOGO' , 'customizr'),
'section' => 'logo_sec',
'sanitize_callback' => array( $this , 'tc_sanitize_number' ),
//we can define suggested cropping area and allow it to be flexible (def 150x150 and not flexible)
'width' => 250,
'height' => 100,
'flex_width' => true,
'flex_height' => true,
//to keep the selected cropped size
'dst_width' => false,
'dst_height' => false
),
//force logo resize 250 * 85
'tc_logo_resize' => array(
'default' => 1,
'label' => __( 'Force logo dimensions to max-width:250px and max-height:100px' , 'customizr' ),
'control' => 'TC_controls' ,
'section' => 'logo_sec' ,
'type' => 'checkbox' ,
'notice' => __( "Uncheck this option to keep your original logo dimensions." , 'customizr')
),
'tc_sticky_logo_upload' => array(
'control' => version_compare( $wp_version, '4.3', '>=' ) ? 'TC_Customize_Cropped_Image_Control' : 'TC_Customize_Upload_Control',
'label' => __( 'Sticky Logo Upload (supported formats : .jpg, .png, .gif, svg, svgz)' , 'customizr' ),
'section' => 'logo_sec' ,
'sanitize_callback' => array( $this , 'tc_sanitize_number' ),
//we can define suggested cropping area and allow it to be flexible (def 150x150 and not flexible)
'width' => 75,
'height' => 30,
'flex_width' => true,
'flex_height' => true,
//to keep the selected cropped size
'dst_width' => false,
'dst_height' => false,
'notice' => __( "Use this upload control to specify a different logo on sticky header mode." , 'customizr')
),
//favicon
'tc_fav_upload' => array(
'control' => 'TC_Customize_Upload_Control' ,
'label' => __( 'Favicon Upload (supported formats : .ico, .png, .gif)' , 'customizr' ),
'title' => __( 'FAVICON' , 'customizr'),
'section' => 'logo_sec' ,
'type' => 'tc_upload',
'sanitize_callback' => array( $this , 'tc_sanitize_number'),
)
);
}
/*-----------------------------------------------------------------------------------------------------
SKIN SECTION
------------------------------------------------------------------------------------------------------*/
function tc_skin_option_map( $get_default = null ) {
return array(
//skin select
'tc_skin' => array(
'default' => 'blue3.css' ,
'control' => 'TC_controls' ,
'label' => __( 'Choose a predefined skin' , 'customizr' ),
'section' => 'skins_sec' ,
'type' => 'select' ,
'choices' => $this -> tc_build_skin_list(),
'transport' => 'postMessage',
'notice' => __( 'Disabled if the random option is on.' , 'customizr' )
),
'tc_skin_random' => array(
'default' => 0,
'control' => 'TC_controls',
'label' => __('Randomize the skin', 'customizr'),
'section' => 'skins_sec',
'type' => 'checkbox',
'notice' => __( 'Apply a random color skin on each page load.' , 'customizr' )
)
);//end of skin options
}
/*-----------------------------------------------------------------------------------------------------
FONT SECTION
------------------------------------------------------------------------------------------------------*/
function tc_fonts_option_map( $get_default = null ) {
return array(
'tc_fonts' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.2.9' , '1.0.1') ? 'helvetica_arial' : '_g_fjalla_cantarell',
'label' => __( 'Select a beautiful font pair (headings & default fonts) or single font for your website.' , 'customizr' ),
'control' => 'TC_controls',
'section' => 'fonts_sec',
'type' => 'select' ,
'choices' => TC_utils::$inst -> tc_get_font( 'list' , 'name' ),
'priority' => 10,
'transport' => 'postMessage',
'notice' => __( "This font picker allows you to preview and select among a handy selection of font pairs and single fonts. If you choose a pair, the first font will be applied to the site main headings : site name, site description, titles h1, h2, h3., while the second will be the default font of your website for any texts or paragraphs." , 'customizr' )
),
'tc_body_font_size' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.2.9', '1.0.1' ) ? 14 : 15,
'sanitize_callback' => array( $this , 'tc_sanitize_number' ),
'label' => __( 'Set your website default font size in pixels.' , 'customizr' ),
'control' => 'TC_controls',
'section' => 'fonts_sec',
'type' => 'number' ,
'step' => 1,
'min' => 0,
'priority' => 20,
'transport' => 'postMessage',
'notice' => __( "This option sets the default font size applied to any text element of your website, when no font size is already applied." , 'customizr' )
)
);
}
/*-----------------------------------------------------------------------------------------------------
SOCIAL NETWORKS + POSITION SECTION
------------------------------------------------------------------------------------------------------*/
function tc_social_option_map( $get_default = null ) {
return array();//end of social layout map
}
/*-----------------------------------------------------------------------------------------------------
LINKS SECTION
------------------------------------------------------------------------------------------------------*/
function tc_links_option_map( $get_default = null ) {
return array(
'tc_link_scroll' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( 'Smooth scroll on click' , 'customizr' ),
'section' => 'links_sec' ,
'type' => 'checkbox' ,
'notice' => sprintf( '%s
%s : %s', __( 'If enabled, this option activates a smooth page scroll when clicking on a link to an anchor of the same page.' , 'customizr' ), __( 'Important note' , 'customizr' ), __('this option can create conflicts with some plugins, make sure that your plugins features (if any) are working fine after enabling this option.', 'customizr') )
),
'tc_link_hover_effect' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Fade effect on link hover" , "customizr" ),
'section' => 'links_sec' ,
'type' => 'checkbox' ,
'priority' => 20,
'transport' => 'postMessage'
),
'tc_ext_link_style' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Display an icon next to external links" , "customizr" ),
'section' => 'links_sec' ,
'type' => 'checkbox' ,
'priority' => 30,
'notice' => __( 'This will be applied to the links included in post or page content only.' , 'customizr' ),
'transport' => 'postMessage'
),
'tc_ext_link_target' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Open external links in a new tab" , "customizr" ),
'section' => 'links_sec' ,
'type' => 'checkbox' ,
'priority' => 40,
'notice' => __( 'This will be applied to the links included in post or page content only.' , 'customizr' ),
'transport' => 'postMessage'
)
);//end of links options
}
/*-----------------------------------------------------------------------------------------------------
ICONS SECTION
------------------------------------------------------------------------------------------------------*/
function tc_icons_option_map( $get_default = null ) {
return array(
'tc_show_title_icon' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Display icons next to titles" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'priority' => 10,
'notice' => __( 'When this option is checked, a contextual icon is displayed next to the titles of pages, posts, archives, and WP built-in widgets.' , 'customizr' ),
'transport' => 'postMessage'
),
'tc_show_page_title_icon' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.3.0', '1.0.11' ) ? 1 : 0,
'control' => 'TC_controls' ,
'label' => __( "Display a page icon next to the page title" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'priority' => 20,
'transport' => 'postMessage'
),
'tc_show_post_title_icon' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.3.0', '1.0.11' ) ? 1 : 0,
'control' => 'TC_controls' ,
'label' => __( "Display a post icon next to the single post title" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'priority' => 30,
'transport' => 'postMessage'
),
'tc_show_archive_title_icon' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Display an icon next to the archive title" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'notice' => __( 'When this option is checked, an archive type icon is displayed in the heading of every types of archives, on the left of the title. An archive page can be : category, tag, author, date archive, custom taxonomies, search results.' , 'customizr' ),
'priority' => 40,
'transport' => 'postMessage'
),
'tc_show_post_list_title_icon' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.3.0' , '1.0.11' ) ? 1 : 0,
'control' => 'TC_controls' ,
'label' => __( "Display an icon next to each post title in an archive page" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'notice' => __( 'When this option is checked, a post type icon is displayed on the left of each post titles in an archive page. An archive page can be : category, tag, author, date archive, custom taxonomies, search results.' , 'customizr' ),
'priority' => 50,
'transport' => 'postMessage'
),
'tc_show_sidebar_widget_icon' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "WP sidebar widgets : display icons next to titles" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'priority' => 60,
'transport' => 'postMessage'
),
'tc_show_footer_widget_icon' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "WP footer widgets : display icons next to titles" , "customizr" ),
'section' => 'titles_icons_sec' ,
'type' => 'checkbox',
'priority' => 70,
'transport' => 'postMessage'
)
);
}
/*-----------------------------------------------------------------------------------------------------
IMAGE SECTION
------------------------------------------------------------------------------------------------------*/
function tc_images_option_map( $get_default = null ) {
global $wp_version;
$_image_options = array(
'tc_fancybox' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( 'Lightbox effect on images' , 'customizr' ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
'notice' => __( 'If enabled, this option activates a popin window whith a zoom effect when an image is clicked. Note : to enable this effect on the images of your pages and posts, images have to be linked to the Media File.' , 'customizr' ),
),
'tc_fancybox_autoscale' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( 'Autoscale images on zoom' , 'customizr' ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
'notice' => __( 'If enabled, this option will force images to fit the screen on lightbox zoom.' , 'customizr' ),
),
'tc_retina_support' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( 'High resolution (Retina) support' , 'customizr' ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
'notice' => sprintf('%1$s %2$s : %3$s.',
__( 'If enabled, your website will include support for high resolution devices.' , 'customizr' ),
__( "It is strongly recommended to regenerate your media library images in high definition with this free plugin" , 'customizr'),
__( "regenerate thumbnails" , 'customizr'),
admin_url(),
__( "Open the description page of the Regenerate thumbnails plugin" , 'customizr')
)
),
'tc_display_slide_loader' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Sliders : display on loading icon before rendering the slides" , "customizr" ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
'notice' => __( 'When checked, this option displays a loading icon when the slides are being setup.' , 'customizr' ),
),
'tc_center_slider_img' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Dynamic slider images centering on any devices" , "customizr" ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
//'notice' => __( 'This option dynamically centers your images on any devices vertically or horizontally (without stretching them) according to their initial dimensions.' , 'customizr' ),
),
'tc_center_img' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Dynamic thumbnails centering on any devices" , "customizr" ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
'notice' => __( 'This option dynamically centers your images on any devices, vertically or horizontally according to their initial aspect ratio.' , 'customizr' ),
)
);//end of images options
//add responsive image settings for wp >= 4.4
if ( version_compare( $wp_version, '4.4', '>=' ) )
$_image_options = array_merge( $_image_options, array(
'tc_resp_slider_img' => array(
'default' => 0,
'control' => 'TC_controls' ,
'title' => __( 'Responsive settings', 'customizr' ),
'label' => __( "Enable the WordPress responsive image feature for the slider" , "customizr" ),
'section' => 'images_sec' ,
'type' => 'checkbox' ,
),
'tc_resp_thumbs_img' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Enable the WordPress responsive image feature for the theme's thumbnails" , "customizr" ),
'section' => 'images_sec' ,
'notice' => __( 'This feature has been introduced in WordPress v4.4+ (dec-2015), and might have minor side effects on some of your existing images. Check / uncheck this option to safely verify that your images are displayed nicely.' , 'customizr' ),
'type' => 'checkbox' ,
)
)
);
return $_image_options;
}
/*-----------------------------------------------------------------------------------------------------
RESPONSIVE SETTINGS SECTION
------------------------------------------------------------------------------------------------------*/
function tc_responsive_option_map( $get_default = null ) {
return array(
'tc_block_reorder' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => sprintf(' %s', __( 'Dynamic sidebar reordering on small devices' , 'customizr' ) ),
'section' => 'responsive_sec' ,
'type' => 'checkbox' ,
'notice' => __( 'Activate this option to move the sidebars (if any) after the main content block, for smartphones or tablets viewport.' , 'customizr' ),
)
);//end of links options
}
/*-----------------------------------------------------------------------------------------------------
AUTHORS SECTION
------------------------------------------------------------------------------------------------------*/
function tc_authors_option_map( $get_default = null ) {
return array(
'tc_show_author_info' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Display an author box after each single post content" , "customizr" ),
'section' => 'authors_sec',
'type' => 'checkbox',
'priority' => 1,
'notice' => __( 'Check this option to display an author info block after each single post content. Note : the Biographical info field must be filled out in the user profile.' , 'customizr' ),
)
);
}
/*-----------------------------------------------------------------------------------------------------
SMOOTH SCROLL SECTION
------------------------------------------------------------------------------------------------------*/
function tc_smoothscroll_option_map( $get_default = null ) {
return array(
'tc_smoothscroll' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __("Enable Smooth Scroll", "customizr"),
'section' => 'smoothscroll_sec',
'type' => 'checkbox',
'priority' => 1,
'notice' => __( 'This option enables a smoother page scroll.' , 'customizr' ),
'transport' => 'postMessage'
)
);
}
/******************************************************************************************************
*******************************************************************************************************
* PANEL : HEADER
*******************************************************************************************************
******************************************************************************************************/
/*-----------------------------------------------------------------------------------------------------
HEADER DESIGN AND LAYOUT
------------------------------------------------------------------------------------------------------*/
function tc_header_design_option_map( $get_default = null ) {
return array(
'tc_header_layout' => array(
'default' => 'left',
'title' => __( 'Header design and layout' , 'customizr'),
'control' => 'TC_controls' ,
'label' => __( "Choose a layout for the header" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'select' ,
'choices' => array(
'left' => __( 'Logo / title on the left' , 'customizr' ),
'centered' => __( 'Logo / title centered' , 'customizr'),
'right' => __( 'Logo / title on the right' , 'customizr' )
),
'priority' => 5,
'notice' => __( 'This setting might impact the side on which the menu is revealed.' , 'customizr' ),
),
//enable/disable top border
'tc_top_border' => array(
'default' => 1,//top border on by default
'label' => __( 'Display top border' , 'customizr' ),
'control' => 'TC_controls' ,
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'notice' => __( 'Uncheck this option to remove the colored top border.' , 'customizr' ),
'priority' => 10
),
'tc_show_tagline' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Display the tagline" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 15,
'transport' => 'postMessage'
),
'tc_woocommerce_header_cart' => array(
'default' => 1,
'label' => sprintf(' %s', __( "Display the shopping cart in the header" , "customizr" ) ),
'control' => 'TC_controls' ,
'section' => 'header_layout_sec',
'notice' => __( "WooCommerce: check to display a cart icon showing the number of items in your cart next to your header's tagline.", 'customizr' ),
'type' => 'checkbox' ,
'priority' => 18,
'active_callback' => apply_filters( 'tc_woocommerce_options_enabled', '__return_false' )
),
'tc_social_in_header' => array(
'default' => 1,
'label' => __( 'Social links in header' , 'customizr' ),
'control' => 'TC_controls' ,
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 20,
'transport' => 'postMessage'
),
'tc_display_boxed_navbar' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.3.13', '1.0.18' ) ? 1 : 0,
'control' => 'TC_controls' ,
'label' => __( "Display menu in a box" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 25,
'transport' => 'postMessage',
'notice' => __( 'If checked, this option wraps the header menu/tagline/social in a light grey box.' , 'customizr' ),
),
'tc_sticky_header' => array(
'default' => 1,
'control' => 'TC_controls' ,
'title' => __( 'Sticky header settings' , 'customizr'),
'label' => __( "Sticky on scroll" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 30,
'transport' => 'postMessage',
'notice' => __( 'If checked, this option makes the header stick to the top of the page on scroll down.' , 'customizr' )
),
'tc_sticky_show_tagline' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Sticky header : display the tagline" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 40,
'transport' => 'postMessage',
),
'tc_woocommerce_header_cart_sticky' => array(
'default' => 1,
'label' => sprintf(' %s', __( "Sticky header: display the shopping cart" , "customizr" ) ),
'control' => 'TC_controls' ,
'section' => 'header_layout_sec',
'type' => 'checkbox' ,
'priority' => 45,
'transport' => 'postMessage',
'active_callback' => apply_filters( 'tc_woocommerce_options_enabled', '__return_false' ),
'notice' => __( 'WooCommerce: if checked, your WooCommerce cart icon will remain visible when scrolling.' , 'customizr' )
),
'tc_sticky_show_title_logo' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Sticky header : display the title / logo" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 50,
'transport' => 'postMessage',
),
'tc_sticky_shrink_title_logo' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Sticky header : shrink title / logo" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 60,
'transport' => 'postMessage',
),
'tc_sticky_show_menu' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Sticky header : display the menu" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 60,
'transport' => 'postMessage',
'notice' => __('Also applied to the secondary menu if any.' , 'customizr')
),
'tc_sticky_transparent_on_scroll' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Sticky header : semi-transparent on scroll" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'checkbox' ,
'priority' => 67,
'transport' => 'postMessage',
),
'tc_sticky_z_index' => array(
'default' => 100,
'control' => 'TC_controls' ,
'sanitize_callback' => array( $this , 'tc_sanitize_number' ),
'label' => __( "Set the header z-index" , "customizr" ),
'section' => 'header_layout_sec' ,
'type' => 'number' ,
'step' => 1,
'min' => 0,
'priority' => 70,
'transport' => 'postMessage',
'notice' => sprintf('%1$s %2$s ?',
__( "What is" , 'customizr' ),
__( "the z-index" , 'customizr')
),
)
);
}
/*-----------------------------------------------------------------------------------------------------
NAVIGATION SECTION
------------------------------------------------------------------------------------------------------*/
//NOTE : priorities 10 and 20 are "used" bu menus main and secondary
function tc_navigation_option_map( $get_default = null ) {
return array(
'tc_display_second_menu' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Display a secondary (horizontal) menu in the header." , "customizr" ),
'section' => 'nav' ,
'type' => 'checkbox' ,
'priority' => 15,//must be located between the two menus
'notice' => __( "When you've set your main menu as a vertical side navigation, you can check this option to display a complementary horizontal menu in the header." , 'customizr' ),
),
'tc_menu_style' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.4.0', '1.2.0' ) ? 'navbar' : 'aside',
'control' => 'TC_controls' ,
'title' => __( 'Main menu design' , 'customizr'),
'label' => __( 'Select a design : side menu (vertical) or regular (horizontal)' , 'customizr' ),
'section' => 'nav' ,
'type' => 'select',
'choices' => array(
'navbar' => __( 'Regular (horizontal)' , 'customizr' ),
'aside' => __( 'Side Menu (vertical)' , 'customizr' ),
),
'priority' => 30
),
'tc_menu_resp_dropdown_limit_to_viewport' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => sprintf(' %s', __( "For mobile devices (responsive), limit the height of the dropdown menu block to the visible viewport." , "customizr" ) ),
'section' => 'nav' ,
'type' => 'checkbox' ,
'priority' => 35,
//'transport' => 'postMessage',
),
'tc_display_menu_label' => array(
'default' => 0,
'control' => 'TC_controls' ,
'label' => __( "Display a label next to the menu button." , "customizr" ),
'section' => 'nav' ,
'type' => 'checkbox' ,
'priority' => 45,
'notice' => __( 'Note : the label is hidden on mobile devices.' , 'customizr' ),
),
'tc_menu_position' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.4.0', '1.2.0' ) ? 'pull-menu-left' : 'pull-menu-right',
'control' => 'TC_controls' ,
'label' => __( 'Menu position (for "main" menu)' , "customizr" ),
'section' => 'nav' ,
'type' => 'select' ,
'choices' => array(
'pull-menu-left' => __( 'Menu on the left' , 'customizr' ),
'pull-menu-right' => __( 'Menu on the right' , 'customizr' )
),
'priority' => 50,
'transport' => 'postMessage',
'notice' => sprintf( '%1$s
%2$s',
__( 'When the menu style is set to "Side Menu", the menu position is the side on which the menu will be revealed.' , 'customizr' ),
sprintf( __("To change the global header layout, %s" , "customizr"),
sprintf( '%2$s »',
"javascript:wp.customize.section('header_layout_sec').focus();",
__("jump to the Design and Layout section" , "customizr"),
__("Change the header layout", "customizr")
)
)
)
),
'tc_second_menu_position' => array(
'default' => 'pull-menu-left',
'control' => 'TC_controls' ,
'title' => __( 'Secondary (horizontal) menu design' , 'customizr'),
'label' => __( 'Menu position (for the horizontal menu)' , "customizr" ),
'section' => 'nav' ,
'type' => 'select' ,
'choices' => array(
'pull-menu-left' => __( 'Menu on the left' , 'customizr' ),
'pull-menu-right' => __( 'Menu on the right' , 'customizr' )
),
'priority' => 55,
'transport' => 'postMessage'
),
//The hover menu type has been introduced in v3.1.0.
//For users already using the theme (no theme's option set), the default choice is click, for new users, it is hover.
'tc_menu_type' => array(
'default' => TC_utils::$inst -> tc_user_started_before_version( '3.1.0' , '1.0.0' ) ? 'click' : 'hover',
'control' => 'TC_controls' ,
'label' => __( 'Select a submenu expansion option' , 'customizr' ),
'section' => 'nav' ,
'type' => 'select' ,
'choices' => array(
'click' => __( 'Expand submenus on click' , 'customizr'),
'hover' => __( 'Expand submenus on hover' , 'customizr' ),
),
'priority' => 60
),
'tc_menu_submenu_fade_effect' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Reveal the sub-menus blocks with a fade effect" , "customizr" ),
'section' => 'nav' ,
'type' => 'checkbox' ,
'priority' => 70,
'transport' => 'postMessage',
),
'tc_menu_submenu_item_move_effect' => array(
'default' => 1,
'control' => 'TC_controls' ,
'label' => __( "Hover move effect for the sub menu items" , "customizr" ),
'section' => 'nav' ,
'type' => 'checkbox' ,
'priority' => 80,
'transport' => 'postMessage',
),
'tc_second_menu_resp_setting' => array(
'default' => 'in-sn-before',
'control' => 'TC_controls' ,
'label' => sprintf(' %s', __( "Choose a mobile devices (responsive) behaviour for the secondary menu." , "customizr" ) ),
'section' => 'nav',
'type' => 'select',
'choices' => array(
'in-sn-before' => __( 'Move before inside the side menu ' , 'customizr'),
'in-sn-after' => __( 'Move after inside the side menu ' , 'customizr'),
'display-in-header' => __( 'Display in the header' , 'customizr'),
'hide' => __( 'Hide' , 'customizr' ),
),
'priority' => 90,
// 'notice' => __( 'Note : the label is hidden on mobile devices.' , 'customizr' ),
),
'tc_hide_all_menus' => array(
'default' => 0,
'control' => 'TC_controls' ,
'title' => __( 'Remove all the menus.' , 'customizr'),
'label' => __( "Don't display any menus in the header of your website" , "customizr" ),
'section' => 'nav' ,
'type' => 'checkbox' ,
'priority' => 100,//must be located between the two menus
'notice' => __( 'Use with caution : provide an alternative way to navigate in your website for your users.' , 'customizr' ),
),
); //end of navigation options
}
/******************************************************************************************************
*******************************************************************************************************
* PANEL : CONTENT
*******************************************************************************************************
******************************************************************************************************/
/*-----------------------------------------------------------------------------------------------------
FRONT PAGE SECTION
------------------------------------------------------------------------------------------------------*/
function tc_front_page_option_map( $get_default = null ) {
//prepare the cat picker notice
global $wp_version;
$_cat_picker_notice = sprintf( '%1$s %3$s' ,
__( "Click inside the above field and pick post categories you want to display. No filter will be applied if empty.", 'customizr'),
esc_url('codex.wordpress.org/Posts_Categories_SubPanel'),
__('Learn more about post categories in WordPress' , 'customizr')
);
//for wp version >= 4.3 add deep links
if ( ! version_compare( $wp_version, '4.3', '<' ) ) {
$_cat_picker_notice = sprintf( '%1$s