Fix issue of delimiter not showing when same teams competing in event
This commit is contained in:
@@ -67,11 +67,13 @@ if ( ! function_exists( 'sp_dropdown_taxonomies' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! function_exists( 'sp_the_posts' ) ) {
|
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;
|
echo $before;
|
||||||
if ( ! isset( $post_id ) )
|
if ( ! isset( $post_id ) )
|
||||||
global $post_id;
|
global $post_id;
|
||||||
$posts = get_post_meta( $post_id, $meta, false );
|
$posts = get_post_meta( $post_id, $meta, false );
|
||||||
|
$i = 0;
|
||||||
|
$count = count( $posts );
|
||||||
if ( isset( $posts ) && $posts && is_array( $posts ) ):
|
if ( isset( $posts ) && $posts && is_array( $posts ) ):
|
||||||
foreach ( $posts as $post ):
|
foreach ( $posts as $post ):
|
||||||
$parents = get_post_ancestors( $post );
|
$parents = get_post_ancestors( $post );
|
||||||
@@ -79,11 +81,12 @@ if ( ! function_exists( 'sp_the_posts' ) ) {
|
|||||||
foreach ( $parents as $parent ):
|
foreach ( $parents as $parent ):
|
||||||
if ( !in_array( $parent, $posts ) )
|
if ( !in_array( $parent, $posts ) )
|
||||||
edit_post_link( get_the_title( $parent ), '', ' ', $parent );
|
edit_post_link( get_the_title( $parent ), '', ' ', $parent );
|
||||||
echo '— ';
|
echo $delimiter;
|
||||||
endforeach;
|
endforeach;
|
||||||
edit_post_link( get_the_title( $post ), '', '', $post );
|
edit_post_link( get_the_title( $post ), '', '', $post );
|
||||||
if ( $post != end( $posts ) )
|
if ( ++$i !== $count ) {
|
||||||
echo $sep;
|
echo $sep;
|
||||||
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
echo $after;
|
echo $after;
|
||||||
|
|||||||
Reference in New Issue
Block a user