// Custom page title bar for term archive pages 
// Could also be done with Avada Layouts

add_action('avada_override_current_page_title_bar','custom_page_title_bar_change');
function custom_page_title_bar_change($c_pageID) {
    global $post;
    $post_id = $post->ID;
    
    if ( is_archive() )  {
	    if ( is_tax() )  {
        $term = get_queried_object();	    
		    $tax_slug = $term->taxonomy;
		    $tax = get_taxonomy($tax_slug);
		    $tax_details = get_taxonomy_labels($tax);

		    $page_title_bar_contents = Fusion_Helper::fusion_get_page_title_bar_contents( $post_id );
		    $title = $page_title_bar_contents[0];
		    
		    $subtitle = $tax_details->name;
		    $subtitle = str_replace("Product","",$subtitle);
	    } 
	    else {
		    $page_title_bar_contents = Fusion_Helper::fusion_get_page_title_bar_contents( $post_id );
		    $title = $page_title_bar_contents[0];
	    }
	    //$subtitle = "kari"; 
        $secondary_content = '';
        avada_page_title_bar($title, $subtitle, $secondary_content);
    }else{
	    if ( 'hide' !== fusion_get_option( 'page_title_bar' )) {
          $page_title_bar_contents = Fusion_Helper::fusion_get_page_title_bar_contents( $post_id );
          avada_page_title_bar( $page_title_bar_contents[0], $page_title_bar_contents[1], $page_title_bar_contents[2] );
	    }
   }
}