';
}
}
add_action( 'wp_head', 'saka_pingback_header' );
if ( ! function_exists( 'saka_widget_cat_count' ) ) {
/**
* Change output of category widgets.
*
* @param string $output Return the count with brackets.
* @return string the category widget with output span tag.
* @since 1.2.0
*/
function saka_widget_cat_count( $output ) {
$output = preg_replace( '/<\/a> \((\d+)\)/', ' $1', $output );
return $output;
}
}
add_filter( 'wp_list_categories', 'saka_widget_cat_count' );
if ( ! function_exists( 'saka_widget_archive_count' ) ) {
/**
* Change output of Archive widgets.
*
* @param string $output Arguments for category widget.
* @return string the archive widget with output span tag.
* @since 1.2.0
*/
function saka_widget_archive_count( $output ) {
$output = preg_replace('/<\/a> \((\d+)\)/',' $1', $output );
return $output;
}
}
add_filter( 'get_archives_link', 'saka_widget_archive_count' );
if ( ! function_exists( 'saka_widget_tag_cloud_count' ) ) {
/**
* Remove parentheses of tag cloud widgets.
*
* @param string $output Arguments for tag_cloud widget.
* @return string the tag_cloud widget with output span tag.
* @since 1.2.0
*/
function saka_widget_tag_cloud_count( $output ) {
$output = str_replace( ' (', '', $output );
$output = str_replace( ')', '', $output );
return $output;
}
}
add_filter( 'wp_tag_cloud', 'saka_widget_tag_cloud_count');
if ( ! function_exists( 'saka_thumbnail_url' ) ) {
/**
* If the featured image is not set, placefoler image is displayed.
*
* @param string $size Arguments for post thumbnail size.
* @return string $url the url to set as post thumbnail.
* @since 1.2.0
*/
function saka_thumbnail_url( $size ) {
if ( has_post_thumbnail() ) {
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), esc_html( $size ) );
$url = esc_url( $thumbnail[0] );
} else {
$url = esc_url( saka_customize_archive_placefolder_image() );
}
return $url;
}
}