Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Page title controller.
- */
- function presscore_page_title_controller() {
- global $post;
- $title_align = of_get_option( 'general-title_align', 'center' );
- $title_classes = array( 'page-title' );
- switch( $title_align ) {
- case 'right' :
- $title_classes[] = 'title-right';
- break;
- case 'left' :
- $title_classes[] = 'title-left';
- break;
- default:
- $title_classes[] = 'title-center';
- }
- $before_title = '<div class="' . esc_attr( implode( ' ', $title_classes ) ) . '"><div class="wf-wrap"><div class="wf-table">';
- $after_title = '</div></div></div>';
- $title_template = '<div class="wf-td"><h1>%s</h1></div>';
- $title = '';
- $breadcrumbs = apply_filters( 'dt_sanitize_flag', of_get_option( 'general-show_breadcrumbs', 1 ) );
- $is_single = is_single();
- if ( is_page() || $is_single ) {
- $title_mode = get_post_meta($post->ID, '_dt_header_title', true);
- if ( 'disabled' != $title_mode && presscore_is_content_visible() ) {
- if ( $is_single ) {
- $title_template = '<div class="wf-td"><h1 class="entry-title">%s</h1></div>';
- }
- $title = sprintf( $title_template, apply_filters('the_title', get_the_title($post->ID)) );
- } else {
- $breadcrumbs = false;
- $before_title = $after_title = '';
- }
- } else if ( is_search() ) {
- $message = sprintf( _x( 'Search Results for: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . get_search_query() . '</span>' );
- $title = sprintf( $title_template, $message );
- } else if ( is_archive() ) {
- if ( is_category() ) {
- $message = sprintf( _x( 'Category Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . single_cat_title( '', false ) . '</span>' );
- } elseif ( is_tag() ) {
- $message = sprintf( _x( 'Tag Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . single_tag_title( '', false ) . '</span>' );
- } elseif ( is_author() ) {
- the_post();
- $message = sprintf( _x( 'Author Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' );
- rewind_posts();
- } elseif ( is_day() ) {
- $message = sprintf( _x( 'Daily Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . get_the_date() . '</span>' );
- } elseif ( is_month() ) {
- $message = sprintf( _x( 'Monthly Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
- } elseif ( is_year() ) {
- $message = sprintf( _x( 'Yearly Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . get_the_date( 'Y' ) . '</span>' );
- } elseif ( is_tax('dt_portfolio_category') ) {
- $term = get_queried_object();
- $tax = get_taxonomy( $term->taxonomy );
- $message = sprintf( _x( 'Portfolio Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . single_term_title( $tax->labels->name, false ) . '</span>' );
- } elseif ( is_tax('dt_gallery_category') ) {
- $term = get_queried_object();
- $tax = get_taxonomy( $term->taxonomy );
- $message = sprintf( _x( 'Albums Archives: %s', 'archive template title', LANGUAGE_ZONE ), '<span>' . single_term_title( $tax->labels->name, false ) . '</span>' );
- } else {
- $message = _x( 'Archives:', 'archive template title', LANGUAGE_ZONE );
- }
- $title = sprintf( $title_template, $message );
- } elseif ( is_404() ) {
- $title = sprintf( $title_template, _x('Page not found', 'index title', LANGUAGE_ZONE) );
- } else {
- $title = sprintf( $title_template, _x('Blog', 'index title', LANGUAGE_ZONE) );
- }
- echo $before_title;
- if ( 'right' == $title_align ) {
- echo $breadcrumbs ? presscore_get_breadcrumbs() : '';
- echo apply_filters( 'presscore_page_title', $title, $title_template );
- } else {
- echo apply_filters( 'presscore_page_title', $title, $title_template );
- echo $breadcrumbs ? presscore_get_breadcrumbs() : '';
- }
- echo $after_title;
- }
- add_action('presscore_before_main_container', 'presscore_page_title_controller', 16);
Advertisement
Add Comment
Please, Sign In to add comment