Fix issue of delimiter not showing when same teams competing in event

This commit is contained in:
Takumi
2013-07-26 15:22:14 +10:00
parent efd804222f
commit b69638db20

View File

@@ -67,11 +67,13 @@ if ( ! function_exists( 'sp_dropdown_taxonomies' ) ) {
}
if ( ! function_exists( 'sp_the_posts' ) ) {
function sp_the_posts( $post_id = null, $meta = 'post', $before = '', $sep = ', ', $after = '' ) {
function sp_the_posts( $post_id = null, $meta = 'post', $before = '', $sep = ', ', $after = '', $delimiter = '— ' ) {
echo $before;
if ( ! isset( $post_id ) )
global $post_id;
$posts = get_post_meta( $post_id, $meta, false );
$i = 0;
$count = count( $posts );
if ( isset( $posts ) && $posts && is_array( $posts ) ):
foreach ( $posts as $post ):
$parents = get_post_ancestors( $post );
@@ -79,11 +81,12 @@ if ( ! function_exists( 'sp_the_posts' ) ) {
foreach ( $parents as $parent ):
if ( !in_array( $parent, $posts ) )
edit_post_link( get_the_title( $parent ), '', ' ', $parent );
echo '— ';
echo $delimiter;
endforeach;
edit_post_link( get_the_title( $post ), '', '', $post );
if ( $post != end( $posts ) )
if ( ++$i !== $count ) {
echo $sep;
}
endforeach;
endif;
echo $after;