function avada_get_page_title_bar_contents($post_id, $get_secondary_content = TRUE)
 {
     if ($get_secondary_content) {
         ob_start();
         if (fusion_get_option('page_title_bar_bs', 'page_title_breadcrumbs_search_bar', $post_id) != 'none') {
             if ('Breadcrumbs' == Avada()->settings->get('page_title_bar_bs') && in_array(get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true), array('breadcrumbs', 'default', '')) || 'breadcrumbs' == get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true)) {
                 fusion_breadcrumbs();
             } elseif ('Search Box' == Avada()->settings->get('page_title_bar_bs') && in_array(get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true), array('searchbar', 'default', '')) || 'searchbar' == get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true)) {
                 get_search_form();
             }
         }
         $secondary_content = ob_get_contents();
         ob_get_clean();
     } else {
         $secondary_content = '';
     }
     $title = '';
     $subtitle = '';
     if ('' != get_post_meta($post_id, 'pyre_page_title_custom_text', true)) {
         $title = get_post_meta($post_id, 'pyre_page_title_custom_text', true);
     }
     if ('' != get_post_meta($post_id, 'pyre_page_title_custom_subheader', true)) {
         $subtitle = get_post_meta($post_id, 'pyre_page_title_custom_subheader', true);
     }
     if ('' == get_post_meta($post_id, 'pyre_page_title_text', true) || 'default' == get_post_meta($post_id, 'pyre_page_title_text', true)) {
         $page_title_text = Avada()->settings->get('page_title_bar_text');
     } else {
         $page_title_text = get_post_meta($post_id, 'pyre_page_title_text', true);
     }
     if (!$title) {
         $title = get_the_title();
         if (is_home()) {
             $title = Avada()->settings->get('blog_title');
         }
         if (is_search()) {
             $title = sprintf(__('Search results for: %s', 'Avada'), get_search_query());
         }
         if (is_404()) {
             $title = __('Error 404 Page', 'Avada');
         }
         if (class_exists('Tribe__Events__Main') && (tribe_is_event() && !is_single() && !is_home() || is_events_archive() || is_events_archive() && is_404())) {
             $title = tribe_get_events_title();
         }
         if (is_archive() && !is_bbpress() && !is_search()) {
             if (is_day()) {
                 $title = sprintf(__('Daily Archives: %s', 'Avada'), '<span>' . get_the_date() . '</span>');
             } else {
                 if (is_month()) {
                     $title = sprintf(__('Monthly Archives: %s', 'Avada'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'Avada')) . '</span>');
                 } elseif (is_year()) {
                     $title = sprintf(__('Yearly Archives: %s', 'Avada'), '<span> ' . get_the_date(_x('Y', 'yearly archives date format', 'Avada')) . '</span>');
                 } elseif (is_author()) {
                     $curauth = get_user_by('id', get_query_var('author'));
                     $title = $curauth->nickname;
                 } elseif (is_post_type_archive()) {
                     $title = post_type_archive_title('', false);
                     $sermon_settings = get_option('wpfc_options');
                     if (is_array($sermon_settings)) {
                         $title = $sermon_settings['archive_title'];
                     }
                 } else {
                     $title = single_cat_title('', false);
                 }
             }
         }
         if (class_exists('WooCommerce') && is_woocommerce() && (is_product() || is_shop()) && !is_search()) {
             if (!is_product()) {
                 $title = woocommerce_page_title(false);
             }
         }
     }
     if (!$subtitle && is_home()) {
         $subtitle = Avada()->settings->get('blog_subtitle');
     }
     if (!is_archive() && !is_search() && !(is_home() && !is_front_page())) {
         if ('no' == $page_title_text && ('yes' == get_post_meta($post_id, 'pyre_page_title', true) || 'yes_without_bar' == get_post_meta($post_id, 'pyre_page_title', true) || 'hide' != Avada()->settings->get('page_title_bar') && 'no' != get_post_meta($post_id, 'pyre_page_title', true))) {
             $title = '';
             $subtitle = '';
         }
     } else {
         if ('hide' != Avada()->settings->get('page_title_bar') && 'no' == $page_title_text) {
             $title = '';
             $subtitle = '';
         }
     }
     return array($title, $subtitle, $secondary_content);
 }
Example #2
0
 function avada_get_page_title_bar_contents($post_id, $get_secondary_content = TRUE)
 {
     global $smof_data;
     if ($get_secondary_content) {
         ob_start();
         if (fusion_get_option('page_title_bar_bs', 'page_title_breadcrumbs_search_bar', $post_id) != 'none') {
             if ($smof_data['page_title_bar_bs'] == 'Breadcrumbs' && get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == 'breadcrumbs' || $smof_data['page_title_bar_bs'] != 'Breadcrumbs' && get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == 'breadcrumbs' || $smof_data['page_title_bar_bs'] == 'Breadcrumbs' && (get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == 'default' || get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == '')) {
                 fusion_breadcrumbs();
             } else {
                 if ($smof_data['page_title_bar_bs'] == 'Search Box' && get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == 'searchbar' || $smof_data['page_title_bar_bs'] != 'Search Box' && get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == 'searchbar' || $smof_data['page_title_bar_bs'] == 'Search Box' && (get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == 'default' || get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true) == '')) {
                     get_search_form();
                 }
             }
         }
         $secondary_content = ob_get_contents();
         ob_get_clean();
     } else {
         $secondary_content = '';
     }
     $title = '';
     $subtitle = '';
     if (get_post_meta($post_id, 'pyre_page_title_custom_text', true) != '') {
         $title = get_post_meta($post_id, 'pyre_page_title_custom_text', true);
     }
     if (get_post_meta($post_id, 'pyre_page_title_custom_subheader', true) != '') {
         $subtitle = get_post_meta($post_id, 'pyre_page_title_custom_subheader', true);
     }
     if (get_post_meta($post_id, 'pyre_page_title_text', true) == '' || get_post_meta($post_id, 'pyre_page_title_text', true) == 'default') {
         $page_title_text = $smof_data['page_title_bar_text'];
     } else {
         $page_title_text = get_post_meta($post_id, 'pyre_page_title_text', true);
     }
     if (!$title) {
         $title = get_the_title();
         if (is_home()) {
             $title = $smof_data['blog_title'];
         }
         if (is_search()) {
             $title = __('Search results for:', 'Avada') . ' ' . get_search_query();
         }
         if (is_404()) {
             $title = __('Error 404 Page', 'Avada');
         }
         if (class_exists('TribeEvents') && tribe_is_event() && !is_single() && !is_home() || class_exists('TribeEvents') && is_events_archive() || class_exists('TribeEvents') && is_events_archive() && is_404()) {
             $title = tribe_get_events_title();
         }
         if (is_archive() && !is_bbpress() && !is_search()) {
             if (is_day()) {
                 $title = __('Daily Archives:', 'Avada') . '<span> ' . get_the_date() . '</span>';
             } else {
                 if (is_month()) {
                     $title = __('Monthly Archives:', 'Avada') . '<span> ' . get_the_date(_x('F Y', 'monthly archives date format', 'Avada')) . '</span>';
                 } elseif (is_year()) {
                     $title = __('Yearly Archives:', 'Avada') . '<span> ' . get_the_date(_x('Y', 'yearly archives date format', 'Avada')) . '</span>';
                 } elseif (is_author()) {
                     $curauth = get_user_by('id', get_query_var('author'));
                     $title = $curauth->nickname;
                 } elseif (is_post_type_archive()) {
                     $title = post_type_archive_title('', false);
                     $sermon_settings = get_option('wpfc_options');
                     if (is_array($sermon_settings)) {
                         $title = $sermon_settings['archive_title'];
                     }
                 } else {
                     $title = single_cat_title('', false);
                 }
             }
         }
         if (class_exists('Woocommerce') && is_woocommerce() && (is_product() || is_shop()) && !is_search()) {
             if (!is_product()) {
                 $title = woocommerce_page_title(false);
             }
         }
     }
     if (!$subtitle) {
         if (is_home()) {
             $subtitle = $smof_data['blog_subtitle'];
         }
     }
     if (!is_archive() && !is_search() && !(is_home() && !is_front_page())) {
         if (get_post_meta($post_id, 'pyre_page_title', true) == 'yes' || get_post_meta($post_id, 'pyre_page_title', true) == 'yes_without_bar' || $smof_data['page_title_bar'] != 'hide' && get_post_meta($post_id, 'pyre_page_title', true) != 'no') {
             if ($page_title_text == 'no') {
                 $title = '';
                 $subtitle = '';
             }
         }
     } else {
         if ($smof_data['page_title_bar'] != 'hide') {
             if ($page_title_text == 'no') {
                 $title = '';
                 $subtitle = '';
             }
         }
     }
     return array($title, $subtitle, $secondary_content);
 }