-
AuthorPosts
-
December 15, 2017 at 2:22 pm #889302
i do have the snippet for doing setting up on every page/post.
But is there a way to have that only defined on for example a page array or a custom class.
I have a new customer with two main parts of his work.
I want to have the one with header_left – the other one with header_right.here is the code for that manual way. But then i have to set it up for each page/post:
add_filter('avf_builder_elements', 'register_meta_elements', 10, 1); function register_meta_elements($avf_builder_elements) { $avf_builder_elements[] = array( "slug" => "layout", "name" => __("Header Position",'avia_framework'), "id" => "header_position", "desc" => "Select the position of the header", "type" => "select", "std" => "", "class" => "avia-style", "subtype" => array( __("Default",'avia_framework') => '', __('Top Header','avia_framework') =>'header_top', __('Sidebar Header (Left)','avia_framework') =>'header_left header_sidebar', __('Sidebar Header (Right)','avia_framework') =>'header_right header_sidebar', ) ); return $avf_builder_elements; } if(!function_exists('avia_header_setting')) { function avia_header_setting($single_val = false) { global $avia_config; if(isset($avia_config['header_settings']) && $single_val && isset($avia_config['header_settings'][$single_val])) return $avia_config['header_settings'][$single_val]; if(isset($avia_config['header_settings']) && !$single_val) return $avia_config['header_settings']; //return cached header setting if available $defaults = array( 'header_position' => 'header_top', 'header_layout'=>'logo_left menu_right', 'header_size'=>'slim', 'header_custom_size'=>'', 'header_sticky'=>'header_sticky', 'header_shrinking'=>'header_shrinking', 'header_title_bar'=>'', 'header_social'=>'', 'header_unstick_top' =>'', 'header_secondary_menu'=>'', 'header_stretch'=>'', 'header_custom_size'=>'', 'header_phone_active'=>'', 'header_replacement_logo'=>'', 'header_replacement_menu'=>'', 'header_mobile_behavior' => '', 'header_searchicon' => true, 'header_mobile_activation' => 'mobile_menu_phone', 'phone'=>'', 'sidebarmenu_sticky' => 'conditional_sticky', 'layout_align_content' => 'content_align_center', 'sidebarmenu_widgets' => '', 'sidebarmenu_social' => 'disabled', 'header_menu_border' => '', 'header_style' => '' ); $settings = avia_get_option(); //overwrite with custom fields if they are set $post_id = avia_get_the_id(); if($post_id && is_singular()) { $custom_fields = get_post_custom($post_id); foreach($defaults as $key =>$default) { if(!empty($custom_fields[$key]) && !empty($custom_fields[$key][0]) ) { $settings[$key] = $custom_fields[$key][0]; } } //check if header transparency is set to true $transparency = post_password_required() ? false : get_post_meta($post_id, 'header_transparency', true); if(get_post_meta($post_id, 'header_position', true)){ $header['header_position'] = get_post_meta($post_id, 'header_position', true); } } $header = shortcode_atts($defaults, $settings); $header['header_scroll_offset'] = avia_get_header_scroll_offset($header); if($header['header_position'] != "header_top") return avia_header_setting_sidebar($header, $single_val); //set header transparency $header['header_transparency'] = ""; if(!empty($transparency)) $header['header_transparency'] = 'header_transparency'; if(!empty($transparency) && strpos($transparency, 'glass')) $header['header_transparency'] .= ' header_glassy'; if(!empty($transparency) && strpos($transparency, 'hidden')) $header['disabled'] = true; if(!empty($transparency) && strpos($transparency, 'scrolldown')) { $header['header_transparency'] .= ' header_scrolldown'; $header['header_sticky'] = 'header_sticky'; } //deactivate title bar if header is transparent if(!empty($transparency)) $header['header_title_bar'] = 'hidden_title_bar'; //sticky and shrinking are tied together if($header['header_sticky'] == 'disabled') { $header['header_shrinking'] = 'disabled'; $header['header_scroll_offset'] = 0; } //if the custom height is less than 70 shrinking doesnt really work if($header['header_size'] == 'custom' && (int) $header['header_custom_size'] < 65) $header['header_shrinking'] = 'disabled'; //create a header class so we can style properly $header_class_var = array( 'header_position', 'header_layout', 'header_size', 'header_sticky', 'header_shrinking', 'header_stretch', 'header_mobile_activation', 'header_transparency', 'header_searchicon', 'header_unstick_top', 'header_menu_border', 'header_style' ); $header['header_class'] = ""; foreach($header_class_var as $class_name) { if(!empty($header[$class_name])) { if($header[$class_name] == "disabled") $header[$class_name] = $class_name."_disabled"; $header['header_class'] .= " av_".str_replace(' ',' av_',$header[$class_name]); } } //set manual flag if we should display the top bar $header['header_topbar'] = false; if(strpos($header['header_social'], 'extra_header_active') !== false || strpos($header['header_secondary_menu'], 'extra_header_active') !== false || !empty($header['header_phone_active'])){ $header['header_topbar'] = 'header_topbar_active'; } //set manual flag if the menu is at the bottom $header['bottom_menu'] = false; if(strpos($header['header_layout'],'bottom_nav_header') !== false) { $header['bottom_menu'] = 'header_bottom_menu_active'; } else { $header['header_class'] .= " av_bottom_nav_disabled "; } //header class that tells us to use the alternate logo if(!empty($header['header_replacement_logo'])) { $header['header_class'] .= " av_alternate_logo_active"; if(is_numeric($header['header_replacement_logo'])) { $header['header_replacement_logo'] = wp_get_attachment_image_src($header['header_replacement_logo'], 'full'); $header['header_replacement_logo'] = $header['header_replacement_logo'][0]; } } //header class that tells us to use the alternate logo if(empty($header['header_menu_border'])) { $header['header_class'] .= " av_header_border_disabled"; } $header = apply_filters('avf_header_setting_filter', $header); //make settings available globaly $avia_config['header_settings'] = $header; if(!empty($single_val) && isset($header[$single_val])) return $header[$single_val]; return $header; } }
December 22, 2017 at 6:55 am #891484Hey Guenter,
I think it’s possible with “avf_header_setting_filter” filter. It’s in the functions-enfold.php file.
Best regards,
IsmaelDecember 22, 2017 at 11:59 am #891539yes – but i only want to change the header_position from header_left to header_right.
so i put in:
add_filter('avf_header_setting_filter','av_change_header_style'); function av_change_header_style($header) { if( is_page('332') ){ $header['header_position'] = "header_right header_sidebar"; } return $header; }
this works – but i have to make a lot of style adjustments ( f.e. .avia-post-prev and .avia-post-next – the position) etc. pp
how can i get it that on change the rest will work as if i set it up in enfold options dialog.- This reply was modified 6 years, 11 months ago by Guenni007.
December 24, 2017 at 4:36 am #891913Hi,
You’ll have to control those elements with css, unfortunately.
.html_what_ever_header_settings .avia-post-prev { /* style here */ }
Example:
.html_header_right .avia-post-next { /* style here */ }
Best regards,
IsmaelJanuary 4, 2018 at 2:36 pm #893251sorry Ismael – for late reply.
i was afraid of that.Nevertheless Thread can be closed. I managed for that specific webpage now a Multisite Solution. And that makes some settings obsolete.
f.e. the request to have different main menus on some pages etc.Thanks as always
January 5, 2018 at 6:16 am #893562 -
AuthorPosts
- The topic ‘how tho switch header_right to header_left for specific pages’ is closed to new replies.