Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #769701

    Is it possible to add a second header style (instead of using the same theme header throughout the whole website)? So, if users are on certain pages, I’d like to change the header style to look like a sub-company of the main company (different color with different style logo).
    Thanks!

    #769972

    It is, go to Avia builder, and “content elements” and choose “fullwidth sub menu” there you can either build an simple menu, or use an exicisting menu you have created in the menu section of WP.

    Regards
    /Chris

    #770089

    I’m not sure how the menu or “sub menu” affects the header? I was asking how to apply a different header style/themes to different pages on my site. I wanted to use more than one header.
    Thanks!

    #770322

    Hi webdesign,

    Yes, it is possible. In WordPress the body element gets the class of post ID or page ID, so you can target header for the pages or posts that you need.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #770343

    Thank you for your reply. I think we are getting closer, but can you describe this in a little more detail? I want a second header with a different color and different logo. So, when I am on certain pages, that second header will show up (not the main header). I have a child theme and thought the second header should be saved here? But, when I make make changes to the current header style from the admin panel, I can’t find where these changes are made. What files get changed when you change the color and logo of the main site header? Thanks!

    #770440

    well there was a snippet ( a bit bigger than the others) to have for each page/post the opportunity to choose if header is top, left or right.
    for that snippet you have to use by default first the top header and than switch on the page.

    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;
      }
    }

    f.e. look here: https://webers-testseite.de/kokon/beispiel-seite/

    and than have a look to the other pages.

    #770444

    by the way – go and have a look here – there are some hints to settings:

    https://kriesi.at/support/topic/ability-to-select-header-position-on-page-overwrite-theme-settings/

    #770615

    Hi,

    Thanks for sharing @guenni007. Did you check that out and did you have any luck with it @webdesign?

    Best regards,
    Rikard

    #771189

    by the way rikard : if he likes to have on those pages a different logo:

    i see that those pages got on html the class html_header_left
    can i make an if clause with a different logo when html has Class html_header_left ?

    i tried if ($('html').hasClass('html_header_left') but had no luck on it.

    #773654

    Hi,

    Maybe, you can change the src attribute of the logo image. Something like this:

    $('.html_header_sidebar .logo').find('img').attr('src', 'LOGO HERE');
    

    Best regards,
    Ismael

    #773898

    thanks ismael – i will test it and then goes to my personal snippet list

    i did it this way:

    function avia_custom_logo(){
    ?>
     <script>
    jQuery('.html_header_sidebar .logo').find('img').attr('src', 'path to the new logo');
     </script>
    <?php
    }
    add_action('wp_footer', 'avia_custom_logo');
    • This reply was modified 7 years, 8 months ago by Guenni007.
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.