tle, let's reset to the site name.
if ( empty( $title ) && 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID ) {
$title = aioseo()->helpers->decodeHtmlEntities( get_bloginfo( 'name' ) );
}
if ( empty( $title ) ) {
// Just return the WP default.
$title = get_the_title( $post->ID ) . ' - ' . get_bloginfo( 'name' );
$title = aioseo()->helpers->decodeHtmlEntities( $title );
}
$posts[ $post->ID ] = $title;
return $posts[ $post->ID ];
}
/**
* Retrieve the default title for the post type.
*
* @since 4.0.6
*
* @param string $postType The post type.
* @return string The title.
*/
public function getPostTypeTitle( $postType ) {
static $postTypeTitle = [];
if ( isset( $postTypeTitle[ $postType ] ) ) {
return $postTypeTitle[ $postType ];
}
if ( aioseo()->dynamicOptions->searchAppearance->postTypes->has( $postType ) ) {
$title = aioseo()->dynamicOptions->searchAppearance->postTypes->{$postType}->title;
}
$postTypeTitle[ $postType ] = empty( $title ) ? '' : $title;
return $postTypeTitle[ $postType ];
}
/**
* Returns the term title.
*
* @since 4.0.6
*
* @param \WP_Term $term The term object.
* @param boolean $default Whether we want the default value, not the post one.
* @return string The term title.
*/
public function getTermTitle( $term, $default = false ) {
if ( ! is_a( $term, 'WP_Term' ) ) {
return '';
}
static $terms = [];
if ( isset( $terms[ $term->term_id ] ) ) {
return $terms[ $term->term_id ];
}
$title = '';
$dynamicOptions = aioseo()->dynamicOptions->noConflict();
if ( ! $title && $dynamicOptions->searchAppearance->taxonomies->has( $term->taxonomy ) ) {
$newTitle = aioseo()->dynamicOptions->searchAppearance->taxonomies->{$term->taxonomy}->title;
$newTitle = preg_replace( '/#taxonomy_title/', aioseo()->helpers->escapeRegexReplacement( $term->name ), $newTitle );
$title = $this->helpers->prepare( $newTitle, $term->term_id, $default );
}
$terms[ $term->term_id ] = $title;
return $terms[ $term->term_id ];
}
}