0) {
$excerpt_length = absint($excerpt_length);
}
return absint($excerpt_length);
}
endif;
add_filter('excerpt_length', 'starter_gazette_excerpt_length', 999);
/**
* Returns word count of the sentences.
*
* @since Starter Gazette 1.0.0
*/
if (!function_exists('starter_gazette_words_count')) :
function starter_gazette_words_count($length = 25, $starter_gazette_content = null)
{
$length = absint($length);
$source_content = preg_replace('`\[[^\]]*\]`', '', $starter_gazette_content);
$trimmed_content = wp_trim_words($source_content, $length, '');
return $trimmed_content;
}
endif;
if (!function_exists('starter_gazette_excerpt_more') ):
/**
* Implement read more in excerpt.
*
* @since 1.0.0
*
* @param string $more The string shown within the more link.
* @return string The excerpt.
*/
function starter_gazette_excerpt_more($more) {
if (is_admin()) {
return $more;
}
$flag_apply_excerpt_read_more = apply_filters('starter_gazette_filter_excerpt_read_more', true);
if (true !== $flag_apply_excerpt_read_more) {
return $more;
}
$output = $more;
$read_more_text = esc_html(starter_gazette_get_option('read_more_button_text'));
if (!empty($read_more_text)) {
$output = ' '.esc_html($read_more_text).'';
$output = apply_filters('starter_gazette_filter_read_more_link', $output);
}
return $output;
}
add_filter('excerpt_more', 'starter_gazette_excerpt_more');
endif;
if (!function_exists('starter_gazette_posts_navigations')):
/**
* Posts navigation.
*
* @since 1.0.0
*/
function starter_gazette_posts_navigations() {
$pagination_type = starter_gazette_get_option('pagination_type');
switch ($pagination_type) {
case 'default':
the_posts_navigation();
break;
case 'numeric':
the_posts_pagination();
break;
default:
break;
}
}
endif;
add_action('starter_gazette_posts_navigation', 'starter_gazette_posts_navigations');
function starter_gazette_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
}
elseif ( is_tag() ) {
$title = single_tag_title( '', false );
}
elseif ( is_author() ) {
$title = '' . get_the_author() . '';
}
elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
}
elseif ( is_tax() ) {
$title = single_term_title( '', false );
}
elseif ( is_date() ) {
$title = single_term_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'starter_gazette_archive_title' );