[WordPress] Twenty Sixteenでカテゴリとタグが複数ある場合に間に入る「,」(カンマ)を消す方法

WordPress

Twenty Sixteenでカテゴリとタグが複数ある場合に間に入る「,」(カンマ)を消す方法を紹介します。

wp-content/themes/twentysixteen/inc/template-tags.phpを編集します。関数twentysixteen_entry_taxonomiesを以下のように変更してください。

「’, ‘」を「’ ‘」にするだけです。

function twentysixteen_entry_taxonomies() {
	// $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
	// ↑を↓のように修正
	$categories_list = get_the_category_list( _x( ' ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
	if ( $categories_list && twentysixteen_categorized_blog() ) {
		printf(
			'<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
			_x( 'Categories', 'Used before category names.', 'twentysixteen' ),
			$categories_list
		);
	}
	// $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
	// ↑を↓のように修正
	$tags_list = get_the_tag_list( '', _x( ' ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
	if ( $tags_list && ! is_wp_error( $tags_list ) ) {
		printf(
			'<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
			_x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
			$tags_list
		);
	}
}

広告