must always check the local context inside the callback before appending new css //fired on hook : wp_enqueue_scripts //Set thumbnail specific design based on user options //Set top border style option add_filter( 'tc_user_options_style' , array( $this , 'czr_fn_write_header_inline_css') ); } /*************************** * HEADER HOOKS SETUP ****************************/ /** * Set all header hooks * wp callback * @return void * * @package Customizr * @since Customizr 3.2.6 */ function czr_fn_set_header_hooks() { //The WP favicon (introduced in WP 4.3) will be used in priority add_action ( 'wp_head' , array( $this , 'czr_fn_favicon_display' )); //html > header actions add_action ( '__before_main_wrapper' , 'get_header'); //boolean filter to control the header's rendering if ( ! apply_filters( 'tc_display_header', true ) ) return; add_action ( '__header' , array( $this , 'czr_fn_prepare_logo_title_display' ) , 10 ); add_action ( '__header' , array( $this , 'czr_fn_tagline_display' ) , 20, 1 ); add_action ( '__header' , array( $this , 'czr_fn_navbar_display' ) , 30 ); //New menu view (since 3.2.0) add_filter ( 'tc_navbar_display', array( $this , 'czr_fn_new_menu_view'), 10, 2); //body > header > navbar actions ordered by priority // GY : switch order for RTL sites if (is_rtl()) { add_action ( '__navbar' , array( $this , 'czr_fn_social_in_header' ) , 20, 2 ); add_action ( '__navbar' , array( $this , 'czr_fn_tagline_display' ) , 10, 1 ); } else { add_action ( '__navbar' , array( $this , 'czr_fn_social_in_header' ) , 10, 2 ); add_action ( '__navbar' , array( $this , 'czr_fn_tagline_display' ) , 20, 1 ); } //add a 100% wide container just after the sticky header to reset margin top if ( 1 == esc_attr( czr_fn_opt( 'tc_sticky_header' ) ) || czr_fn_is_customizing() ) add_action( '__after_header' , array( $this, 'czr_fn_reset_margin_top_after_sticky_header'), 0 ); } /** * Callback for wp * Set customizer user options * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_set_header_options() { //Set some body classes add_filter( 'body_class' , array( $this , 'czr_fn_add_body_classes') ); //Set header classes from options add_filter( 'tc_header_classes' , array( $this , 'czr_fn_set_header_classes') ); //Set logo layout with a customizer option (since 3.2.0) add_filter( 'tc_logo_class' , array( $this , 'czr_fn_set_logo_title_layout') ); } /*************************** * VIEWS ****************************/ /** * Render favicon from options * Since WP 4.3 : let WP do the job if user has set the WP site_icon setting. * * @package Customizr * @since Customizr 3.0 */ function czr_fn_favicon_display() { //is there a WP favicon set ? //if yes then let WP do the job if ( function_exists('has_site_icon') && has_site_icon() ) return; $_fav_option = esc_attr( czr_fn_opt( 'tc_fav_upload') ); if ( ! $_fav_option || is_null($_fav_option) ) return; $_fav_src = ''; //check if option is an attachement id or a path (for backward compatibility) if ( is_numeric($_fav_option) ) { $_attachement_id = $_fav_option; $_attachment_data = apply_filters( 'tc_fav_attachment_img' , wp_get_attachment_image_src( $_fav_option , 'full' ) ); $_fav_src = $_attachment_data[0]; } else { //old treatment $_saved_path = esc_url ( czr_fn_opt( 'tc_fav_upload') ); //rebuild the path : check if the full path is already saved in DB. If not, then rebuild it. $upload_dir = wp_upload_dir(); $_fav_src = ( false !== strpos( $_saved_path , '/wp-content/' ) ) ? $_saved_path : $upload_dir['baseurl'] . $_saved_path; } //makes ssl compliant url $_fav_src = apply_filters( 'tc_fav_src' , is_ssl() ? str_replace('http://', 'https://', $_fav_src) : $_fav_src ); if( null == $_fav_src || !$_fav_src ) return; $type = "image/x-icon"; if ( strpos( $_fav_src, '.png') ) $type = "image/png"; if ( strpos( $_fav_src, '.gif') ) $type = "image/gif"; echo apply_filters( 'tc_favicon_display', sprintf('' , $_fav_src, $type ) ); } /** * Prepare the logo / title view * * * @package Customizr * @since Customizr 3.2.3 */ function czr_fn_prepare_logo_title_display() { $logos_type = array( '_sticky_', '_'); $logos_img = array(); $accepted_formats = apply_filters( 'tc_logo_img_formats' , array('jpg', 'jpeg', 'png' ,'gif', 'svg', 'svgz' ) ); $logo_classes = array( 'brand', 'span3'); foreach ( $logos_type as $logo_type ){ // check if we have to print the sticky logo if ( '_sticky_' == $logo_type && ! $this -> czr_fn_use_sticky_logo() ) continue; //check if the logo is a path or is numeric //get src for both cases $_logo_src = ''; $_width = false; $_height = false; $_attachement_id = false; //for the standard logo use the wp custom logo feature if set, otherwise fall back on the customizr custom logo $_logo_option = '_' === $logo_type ? get_theme_mod( 'custom_logo', '' ) : ''; $_logo_option = $_logo_option ? $_logo_option : esc_attr( czr_fn_opt( "tc{$logo_type}logo_upload") ); //check if option is an attachement id or a path (for backward compatibility) if ( is_numeric($_logo_option) ) { $_attachement_id = $_logo_option; $_attachment_data = apply_filters( "tc{$logo_type}logo_attachment_img" , wp_get_attachment_image_src( $_logo_option , 'full' ) ); $_logo_src = $_attachment_data[0]; $_width = ( isset($_attachment_data[1]) && $_attachment_data[1] > 1 ) ? $_attachment_data[1] : $_width; $_height = ( isset($_attachment_data[2]) && $_attachment_data[2] > 1 ) ? $_attachment_data[2] : $_height; } else { //old treatment //rebuild the logo path : check if the full path is already saved in DB. If not, then rebuild it. $upload_dir = wp_upload_dir(); $_saved_path = esc_url ( czr_fn_opt( "tc{$logo_type}logo_upload") ); $_logo_src = ( false !== strpos( $_saved_path , '/wp-content/' ) ) ? $_saved_path : $upload_dir['baseurl'] . $_saved_path; } //hook + makes ssl compliant $_logo_src = apply_filters( "tc{$logo_type}logo_src" , is_ssl() ? str_replace('http://', 'https://', $_logo_src) : $_logo_src ) ; $logo_resize = ( $logo_type == '_' ) ? esc_attr( czr_fn_opt( 'tc_logo_resize') ) : ''; $filetype = czr_fn_check_filetype($_logo_src); if( ! empty($_logo_src) && in_array( $filetype['ext'], $accepted_formats ) ) { $_args = array( 'logo_src' => $_logo_src, 'logo_resize' => $logo_resize, 'logo_attachment_id' => $_attachement_id, 'logo_width' => $_width, 'logo_height' => $_height, 'logo_type' => trim($logo_type,'_') ); $logos_img[] = $this -> czr_fn_logo_img_view($_args); } }//end foreach //render if ( count($logos_img) == 0 ) $this -> czr_fn_title_view($logo_classes); else $this -> czr_fn_logo_view( array ( 'logo_class' => $logo_classes, // normal logo first 'logos_img' => array_reverse($logos_img) ) ); } /** * Title view * * @package Customizr * @since Customizr 3.2.3 */ function czr_fn_title_view( $logo_classes ) { ob_start(); ?>
"> %3$s', apply_filters( 'tc_site_title_tag', 'h1' ) , apply_filters( 'tc_logo_link_url', esc_url( home_url( '/' ) ) ) , get_bloginfo( 'name', 'display' ) ); do_action( '__after_logo' ) ?>
', $logo_src, apply_filters( 'tc_logo_alt', __( 'Back Home' , 'customizr' ) ), $logo_width ? sprintf( 'width="%1$s"', $logo_width ) : '', $logo_height ? sprintf( 'height="%1$s"', $logo_height ) : '', ( 1 == $logo_resize) ? sprintf( 'style="max-width:%1$spx;max-height:%2$spx"', apply_filters( 'tc_logo_max_width', 250 ), apply_filters( 'tc_logo_max_height', 100 ) ) : '', implode(' ' , apply_filters('tc_logo_other_attributes' , ( 0 == czr_fn_opt( 'tc_retina_support' ) ) ? array('data-no-retina') : array() ) ), $logo_type, $logo_attachment_id ? sprintf( 'attachment-%1$s', $logo_attachment_id ) : '' ); return apply_filters( 'tc_logo_img_view', $_html, $_args); } /** * Logo view * * @package Customizr * @since Customizr 3.2.3 */ function czr_fn_logo_view( $_args ) { //Exctracts $args : $logo_class, $logos_img (array of ) extract($_args); ob_start(); ?>
"> %3$s', apply_filters( 'tc_logo_link_url', esc_url( home_url( '/' ) ) ) , // keep this filter name for retro-compat, but now it refers to the aria-label attribute. apply_filters( 'tc_logo_link_title', sprintf( '%1$s | %2$s' , get_bloginfo( 'name', 'display' ) , get_bloginfo( 'description', 'display' ) ) ), implode( '', $logos_img ) ); do_action( '__after_logo' ); ?>
', $social_header_block_class, $_socials ); echo apply_filters( 'tc_social_in_header', $html, $resp ); } /** * Displays the tagline. This function has two hooks : __header and __navbar * * * @package Customizr * @since Customizr 3.0 */ function czr_fn_tagline_display() { //do not display tagline if the related option is false or no tagline available if ( 0 == esc_attr( czr_fn_opt( 'tc_show_tagline' ) ) ) return; $_tagline_text = czr_fn_get_tagline_text( $echo = false ); if ( ! $_tagline_text ) return; if ( '__header' == current_filter() ) { //when hooked on __header $html = sprintf('
<%1$s class="site-description">%2$s
', apply_filters( 'tc_tagline_tag', 'h2' ), $_tagline_text ); } else { //when hooked on __navbar $html = sprintf('<%1$s class="%2$s inside site-description">%3$s', apply_filters( 'tc_tagline_tag', 'h2' ), apply_filters( 'tc_tagline_class', 'span7' ), $_tagline_text ); } echo apply_filters( 'tc_tagline_display', $html ); }//end of fn /* * hook : __after_header hook * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_reset_margin_top_after_sticky_header() { echo apply_filters( 'tc_reset_margin_top_after_sticky_header', sprintf('
', apply_filters('tc_default_sticky_header_height' , 103 ) ) ); } /*************************** * SETTER / GETTERS / HELPERS ****************************/ /* * Callback of tc_user_options_style hook * @return css string * * @package Customizr * @since Customizr 3.2.6 */ function czr_fn_write_header_inline_css( $_css ) { //TOP BORDER if ( 1 != esc_attr( czr_fn_opt( 'tc_top_border') ) ) { $_css = sprintf("%s\n%s", $_css, "header.tc-header {border-top: none;}\n" ); } //STICKY HEADER if ( 0 != esc_attr( czr_fn_opt( 'tc_sticky_shrink_title_logo') ) || czr_fn_is_customizing() ) { $_logo_shrink = implode (';' , apply_filters('tc_logo_shrink_css' , array("height:30px!important","width:auto!important") ) ); $_title_font = implode (';' , apply_filters('tc_title_shrink_css' , array("font-size:0.6em","opacity:0.8","line-height:1.2em") ) ); $_css = sprintf("%s\n%s", $_css, ".sticky-enabled .tc-shrink-on .site-logo img { {$_logo_shrink} }\n .sticky-enabled .tc-shrink-on .brand .site-title { {$_title_font} }\n" ); } //STICKY LOGO if ( $this -> czr_fn_use_sticky_logo() ) { $_css = sprintf( "%s\n%s", $_css, ".site-logo img.sticky { display: none; }\n .sticky-enabled .tc-sticky-logo-on .site-logo img { display: none; }\n .sticky-enabled .tc-sticky-logo-on .site-logo img.sticky{ display: inline-block; }\n" ); } //HEADER Z-INDEX if ( 100 != esc_attr( czr_fn_opt( 'tc_sticky_z_index') ) ) { $_custom_z_index = esc_attr( czr_fn_opt( 'tc_sticky_z_index') ); $_css = sprintf("%s\n%s", $_css, ".tc-no-sticky-header .tc-header, .tc-sticky-header .tc-header { z-index:{$_custom_z_index} }\n" ); } return $_css; } /* * Callback of body_class hook * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_add_body_classes($_classes) { //STICKY HEADER if ( 1 == esc_attr( czr_fn_opt( 'tc_sticky_header' ) ) ) { $_classes = array_merge( $_classes, array('tc-sticky-header', 'sticky-disabled') ); //STICKY TRANSPARENT ON SCROLL if ( 1 == esc_attr( czr_fn_opt( 'tc_sticky_transparent_on_scroll' ) ) ) $_classes = array_merge( $_classes, array('tc-transparent-on-scroll') ); else $_classes = array_merge( $_classes, array('tc-solid-color-on-scroll') ); } else { $_classes = array_merge( $_classes, array('tc-no-sticky-header', 'sticky-disabled' ) ); } //No navbar box if ( 1 != esc_attr( czr_fn_opt( 'tc_display_boxed_navbar') ) ) $_classes = array_merge( $_classes , array('no-navbar' ) ); return $_classes; } /** * Set the header classes * Callback for tc_header_classes filter * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_set_header_classes( $_classes ) { //backward compatibility (was not handled has an array in previous versions) if ( ! is_array($_classes) ) return $_classes; $_show_tagline = 0 != esc_attr( czr_fn_opt( 'tc_sticky_show_tagline') ); $_show_title_logo = 0 != esc_attr( czr_fn_opt( 'tc_sticky_show_title_logo') ); $_use_sticky_logo = $this -> czr_fn_use_sticky_logo(); $_shrink_title_logo = 0 != esc_attr( czr_fn_opt( 'tc_sticky_shrink_title_logo') ); $_show_menu = 0 != esc_attr( czr_fn_opt( 'tc_sticky_show_menu') ); $_header_layout = "logo-" . esc_attr( czr_fn_opt( 'tc_header_layout' ) ); $_add_classes = array( $_show_tagline ? 'tc-tagline-on' : 'tc-tagline-off', $_show_title_logo ? 'tc-title-logo-on' : 'tc-title-logo-off', $_use_sticky_logo ? 'tc-sticky-logo-on' : '', $_shrink_title_logo ? 'tc-shrink-on' : 'tc-shrink-off', $_show_menu ? 'tc-menu-on' : 'tc-menu-off', $_header_layout ); return array_merge( $_classes , $_add_classes ); } /** * Returns a boolean wheter we're using or not a specific sticky logo * * @package Customizr * @since Customizr 3.2.9 */ function czr_fn_use_sticky_logo(){ if ( ! esc_attr( czr_fn_opt( "tc_sticky_logo_upload") ) ) return false; if ( ! ( esc_attr( czr_fn_opt( "tc_sticky_header") ) && esc_attr( czr_fn_opt( 'tc_sticky_show_title_logo') ) ) ) return false; return true; } /** * Callback for tc_logo_class * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_set_logo_title_layout( $_classes ) { //backward compatibility (was not handled has an array in previous versions) if ( ! is_array($_classes) ) return $_classes; $_layout = esc_attr( czr_fn_opt( 'tc_header_layout') ); switch ($_layout) { case 'left': $_classes = array('brand', 'span3' , 'pull-left'); break; case 'right': $_classes = array('brand', 'span3' , 'pull-right'); break; default : $_classes = array('brand', 'span3' , 'pull-left'); break; } return $_classes; } }//end of class endif; ?> must always check the local context inside the callback before appending new css //fired on hook : wp_enqueue_scripts //set second menu specific style including @media rules add_filter( 'tc_user_options_style' , array( $this , 'czr_fn_add_second_menu_inline_style') ); //SIDE MENU HOOKS SINCE v3.3+ if ( $this -> czr_fn_is_sidenav_enabled() ){ add_action( 'wp_head' , array( $this , 'czr_fn_set_sidenav_hooks') ); add_filter( 'tc_user_options_style' , array( $this , 'czr_fn_set_sidenav_style') ); } //this adds css classes to the navbar-wrapper : //1) to the main menu if regular (sidenav not enabled) //2) to the secondary menu if enabled if ( ! $this -> czr_fn_is_sidenav_enabled() || czr_fn_is_secondary_menu_enabled() ) { add_filter( 'tc_navbar_wrapper_class' , array( $this, 'czr_fn_set_menu_style_options'), 0 ); } //body > header > navbar action ordered by priority add_action ( '__navbar' , array( $this , 'czr_fn_menu_display' ), 30 ); //adds class add_filter ( 'wp_page_menu' , array( $this , 'czr_fn_add_menuclass' )); } /*************************************** * WP_HEAD HOOKS SETTINGS ****************************************/ /** * Set Various hooks for the sidemenu * hook : wp_head * @return void */ function czr_fn_set_sidenav_hooks() { add_filter( 'body_class' , array( $this, 'czr_fn_sidenav_body_class') ); // disable dropdown on click add_filter( 'tc_menu_open_on_click' , array( $this, 'czr_fn_disable_dropdown_on_click'), 10, 3 ); // add side menu before the page wrapper add_action( '__before_page_wrapper' , array( $this, 'czr_fn_sidenav_display'), 0 ); // add menu button to the sidebar add_action( '__sidenav' , array( $this, 'czr_fn_sidenav_toggle_button_display'), 5 ); // add menu add_action( '__sidenav' , array( $this, 'czr_fn_sidenav_display_menu_customizer'), 10 ); } /*************************************** * VIEWS ****************************************/ /** * Menu Rendering : renders the navbar menus, or just the sidenav toggle button * hook : '__navbar' * * @package Customizr * @since Customizr 3.0 */ function czr_fn_menu_display() { ob_start(); //renders the regular menu + responsive button if ( ! $this -> czr_fn_is_sidenav_enabled() ) { $this -> czr_fn_regular_menu_display( 'main' ); } else { $this -> czr_fn_sidenav_toggle_button_display(); if ( $this -> czr_fn_is_second_menu_enabled() ) $this -> czr_fn_regular_menu_display( 'secondary' ); } $html = ob_get_contents(); ob_end_clean(); echo apply_filters( 'tc_menu_display', $html ); } /** * Menu button View * * @return html string * @package Customizr * @since v3.3+ * */ function czr_fn_menu_button_view( $args ) { //extracts : 'type', 'button_class', 'button_attr' extract( $args ); $_button_label = sprintf( '%s', '__sidenav' == current_filter() ? __('Close', 'customizr') : __('Menu' , 'customizr') ); $_button = sprintf( '
%4$s
', implode(' ', apply_filters( "tc_{$type}_button_class", $button_class ) ), apply_filters( "tc_{$type}_menu_button_attr", $button_attr), '', (bool)esc_attr( czr_fn_opt('tc_display_menu_label') ) ? $_button_label : '', '__sidenav' == current_filter() ? __('Close', 'customizr') : __('Open the menu' , 'customizr') ); return apply_filters( "tc_{$type}_menu_button_view", $_button ); } /** * Menu fallback. Link to the menu editor. * Thanks to tosho (http://wordpress.stackexchange.com/users/73/toscho) * http://wordpress.stackexchange.com/questions/64515/fall-back-for-main-menu * * @package Customizr * @since Customizr 1.0 */ function czr_fn_link_to_menu_editor( $args ) { if ( ! current_user_can( 'manage_options' ) ) return; // see wp-includes/nav-menu-template.php for available arguments extract( $args ); $link = sprintf('%1$s%3$s%4$s%5$s%6$s', $link_before, admin_url( 'nav-menus.php' ), $before, __('Add a menu','customizr'), $after, $link_after ); // We have a list $link = ( FALSE !== stripos( $items_wrap, '' . $link . '' : $link; $output = sprintf( $items_wrap, $menu_id, $menu_class, $link ); $output = ( ! empty ( $container ) ) ? sprintf('<%1$s class="%2$s" id="%3$s">%4$s', $container, $container_class, $container_id, $output ) : $output; if ( $echo ) { echo $output; } return $output; } /*************************************** * REGULAR VIEWS ****************************************/ /** * Prepare params and echo menu views * * @return html string * @since v3.3+ * */ function czr_fn_regular_menu_display( $_location = 'main' ){ $type = 'regular'; $button_where = 'right' != esc_attr( czr_fn_opt( 'tc_header_layout') ) ? 'pull-right' : 'pull-left'; $button_class = array( 'btn-toggle-nav', $button_where ); $button_attr = 'data-toggle="collapse" data-target=".nav-collapse"'; $menu_class = ( ! wp_is_mobile() && 'hover' == esc_attr( czr_fn_opt( 'tc_menu_type' ) ) ) ? array( 'nav tc-hover-menu' ) : array( 'nav' ) ; $menu_wrapper_class = ( ! wp_is_mobile() && 'hover' == esc_attr( czr_fn_opt( 'tc_menu_type' ) ) ) ? array( 'nav-collapse collapse', 'tc-hover-menu-wrapper' ) : array( 'nav-collapse', 'collapse' ); $menu_view = $this -> czr_fn_wp_nav_menu_view( compact( '_location', 'type', 'menu_class', 'menu_wrapper_class' ) ); if ( $menu_view && 'main' == $_location ) $menu_view = $menu_view . $this -> czr_fn_menu_button_view( compact( 'type', 'button_class', 'button_attr') ); echo $menu_view; } /*************************************** * SIDENAV VIEWS ****************************************/ /** * @return html string * @since v3.3+ * * hook: __before_page_wrapper */ function czr_fn_sidenav_display() { ob_start(); $tc_side_nav_class = implode(' ', apply_filters( 'tc_side_nav_class', array( 'tc-sn', 'navbar' ) ) ); $tc_side_nav_inner_class = implode(' ', apply_filters( 'tc_side_nav_inner_class', array( 'tc-sn-inner', 'nav-collapse') ) ); ?> czr_fn_wp_nav_menu_view( compact( '_location', 'type', 'menu_class', 'menu_wrapper_class') ); } /** * @return html string * @since v3.3+ * * hooks: __sidenav, __navbar */ function czr_fn_sidenav_toggle_button_display() { $type = 'sidenav'; $where = 'right' != esc_attr( czr_fn_opt( 'tc_header_layout') ) ? 'pull-right' : 'pull-left'; $button_class = array( 'btn-toggle-nav', 'sn-toggle', $where ); $button_attr = ''; echo $this -> czr_fn_menu_button_view( compact( 'type', 'button_class', 'button_attr') ); } /*************************************** * COMMON VIEW ****************************************/ /** * WP Nav Menu View * * @return html string * @package Customizr * @since Customizr 3.3+ */ function czr_fn_wp_nav_menu_view( $args ) { extract( $args ); //'_location', 'type', 'menu_class', 'menu_wrapper_class' $menu_args = apply_filters( "tc_{$type}_menu_args", array( 'theme_location' => $_location, 'menu_class' => implode(' ', apply_filters( "tc_{$type}_menu_class", $menu_class ) ), 'fallback_cb' => array( $this, 'czr_fn_page_menu' ), //if no menu is set to the required location, fallsback to tc_page_menu //=> tc_page_menu has it's own class extension of Walker, therefore no need to specify one below 'walker' => ! czr_fn_has_location_menu($_location) ? '' : new CZR_nav_walker($_location), 'echo' => false, ) ); $menu = wp_nav_menu( $menu_args ); if ( $menu ) $menu = sprintf('
%2$s
', implode(' ', apply_filters( "tc_{$type}_menu_wrapper_class", $menu_wrapper_class ) ), $menu ); return apply_filters("tc_{$type}_menu_view", $menu ); } /*************************************** * GETTERS / SETTERS ****************************************/ /* * Set navbar menu css classes : effects, position... * hook : tc_navbar_wrapper_class hook * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_set_menu_style_options( $_classes ) { $_classes = ( ! wp_is_mobile() && 0 != esc_attr( czr_fn_opt( 'tc_menu_submenu_fade_effect') ) ) ? array_merge( $_classes, array( 'tc-submenu-fade' ) ) : $_classes; $_classes = ( 0 != esc_attr( czr_fn_opt( 'tc_menu_submenu_item_move_effect') ) ) ? array_merge( $_classes, array( 'tc-submenu-move' ) ) : $_classes; $_classes = ( ! wp_is_mobile() && 'hover' == esc_attr( czr_fn_opt( 'tc_menu_type' ) ) ) ? array_merge( $_classes, array( 'tc-open-on-hover' ) ) : array_merge( $_classes, array( 'tc-open-on-click' ) ); //Navbar menus positions (not sidenav) //CASE 1 : regular menu (sidenav not enabled), controled by option 'tc_menu_position' //CASE 2 : second menu ( is_secondary_menu_enabled ?), controled by option 'tc_second_menu_position' $_menu_position = ''; if ( ! $this -> czr_fn_is_sidenav_enabled() ) $_menu_position = $_classes[] = esc_attr( czr_fn_opt( 'tc_menu_position') ); if ( czr_fn_is_secondary_menu_enabled() ) $_menu_position = $_classes[] = esc_attr( czr_fn_opt( 'tc_second_menu_position') ); if ( 'pull-menu-center' == $_menu_position ) { //pull-menu-center is possible only when logo-centered if ( 'centered' != esc_attr( czr_fn_opt( 'tc_header_layout' ) ) ) array_pop($_classes); //this value will determine the beahavior when logo-center and menu center and .sticky-enabled //or //be the fall-back when menu position is center but the logo is not centered $_classes[] = is_rtl() ? 'pull-menu-left' : 'pull-menu-right'; } return $_classes; } /* * hook : body_class hook * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_add_body_classes($_classes) { //menu type class $_menu_type = $this -> czr_fn_is_sidenav_enabled() ? 'tc-side-menu' : 'tc-regular-menu'; array_push( $_classes, $_menu_type ); return $_classes; } /** * Set the header classes * Callback for tc_header_classes filter * * @package Customizr * @since Customizr 3.4+ */ function czr_fn_set_header_classes( $_classes ) { //backward compatibility (was not handled has an array in previous versions) if ( ! is_array($_classes) ) return $_classes; //adds the second menu state if ( czr_fn_is_secondary_menu_enabled() ) array_push( $_classes, 'tc-second-menu-on' ); //adds the resp. behaviour option for secondary menu array_push( $_classes, 'tc-second-menu-' . esc_attr( czr_fn_opt( 'tc_second_menu_resp_setting' ) . '-when-mobile' ) ); return $_classes; } /* * hook : tc_social_header_block_class hook * * @package Customizr * @since Customizr 3.2.0 */ function czr_fn_set_social_header_class($_classes) { return 'span5'; } /** * Adds a specific class to the ul wrapper * hook : 'wp_page_menu' * * @package Customizr * @since Customizr 3.0 */ function czr_fn_add_menuclass( $ulclass) { $html = preg_replace( '/