|
// custom get_archive_title() modifier |
|
if ( ! function_exists( 'seoleader_get_the_archive_title' ) ) { |
|
function seoleader_get_the_archive_title() { |
|
|
|
if ( is_category() ) { |
|
/* translators: Category archive title. 1: Category name */ |
|
$title = single_cat_title( '', false ); |
|
} elseif ( is_tag() ) { |
|
/* translators: Tag archive title. 1: Tag name */ |
|
$title = single_tag_title( '', false ); |
|
} elseif ( is_author() ) { |
|
/* translators: Author archive title. 1: Author name */ |
|
$title = get_the_author(); |
|
} elseif ( is_year() ) { |
|
/* translators: Yearly archive title. 1: Year */ |
|
$title = get_the_date( _x( 'Y', 'yearly archives date format', 'seoleader' ) ); |
|
} elseif ( is_month() ) { |
|
/* translators: Monthly archive title. 1: Month name and year */ |
|
$title = get_the_date( _x( 'F Y', 'monthly archives date format', 'seoleader' ) ); |
|
} elseif ( is_day() ) { |
|
/* translators: Daily archive title. 1: Date */ |
|
$title = get_the_date( _x( 'F j, Y', 'daily archives date format', 'seoleader' ) ); |
|
} elseif ( is_post_type_archive() ) { |
|
/* translators: Post type archive title. 1: Post type name */ |
|
$title = post_type_archive_title( '', false ); |
|
} elseif ( is_tax() ) { |
|
$tax = get_taxonomy( get_queried_object()->taxonomy ); |
|
/* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term */ |
|
$title = sprintf( __( '%1$s: %2$s', 'seoleader' ), $tax->labels->singular_name, single_term_title( '', false ) ); |
|
} else { |
|
$title = esc_html__( 'Archives', 'seoleader' ); |
|
} |
|
|
|
/** |
|
* Filters the archive title. |
|
* |
|
* @since 4.1.0 |
|
* |
|
* @param string $title Archive title to be displayed. |
|
*/ |
|
return apply_filters( 'seoleader_get_the_archive_title', $title ); |
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// SEOLeader breadcrumbs |
|
if ( ! function_exists( 'seoleader_breadcrumbs' ) ) { |
|
|
|
function seoleader_breadcrumbs() { |
|
echo '<div class="seo-leader-breadcrumbs">'; |
|
|
|
if ( !(is_home() && is_front_page()) && !(!is_home() && is_front_page()) && !(is_home() && !is_front_page()) ) { |
|
printf( "<a href='%s'>". esc_html__( 'Home', 'seoleader' ) ."</a> <span class='breadkcrumbs_sperarator'>»</span> ", esc_url( home_url() ) ); |
|
} |
|
|
|
if ( is_home() && is_front_page() ) { |
|
echo esc_html( bloginfo( 'description' ) ); |
|
} elseif ( !is_home() && is_front_page() ) { |
|
echo esc_html( bloginfo( 'description' ) ); |
|
} elseif ( is_home() && !is_front_page() ) { |
|
echo esc_html( bloginfo( 'description' ) ); |
|
} elseif( is_search() ) { |
|
esc_html_e( 'Search Page', 'seoleader' ); |
|
} |
|
elseif (is_category() ) |
|
{ |
|
echo single_term_title(); |
|
} |
|
elseif ( is_singular() ) |
|
{ |
|
$pt_name = get_post_type( get_the_ID() ); |
|
$obj = get_post_type_object( $pt_name ); |
|
$name = str_replace( array('_', '-'), array(' ', ' '), $pt_name); |
|
if ( is_single() ) { |
|
echo esc_html( get_the_title() ); |
|
} elseif( is_page() ) { |
|
echo esc_html( get_the_title() ); |
|
} else { |
|
echo esc_html( $name ); |
|
} |
|
} |
|
elseif( is_archive() ) { |
|
echo seoleader_get_the_archive_title(); |
|
} |
|
echo '</div>'; |
|
} |
|
|
|
} |