From f600617fc1e40570824de606596f24e0d0ef9439 Mon Sep 17 00:00:00 2001 From: Takumi Date: Fri, 26 Jul 2013 00:36:30 +1000 Subject: [PATCH] Modify function to retrieve multiple posts from single meta key --- helpers.php | 7 +++---- player.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/helpers.php b/helpers.php index cc58b06c..7aebc6e7 100644 --- a/helpers.php +++ b/helpers.php @@ -65,14 +65,13 @@ if ( ! function_exists( 'sp_dropdown_taxonomies' ) ) { } } } -if ( ! function_exists( 'sp_unserialized_posts' ) ) { - function sp_unserialized_posts( $post_id = null, $meta = 'posts', $before = '', $sep = ',', $after = '' ) { +if ( ! function_exists( 'sp_the_posts' ) ) { + function sp_the_posts( $post_id = null, $meta = 'post', $before = '', $sep = ',', $after = '' ) { echo $before; if ( ! isset( $post_id ) ) global $post_id; - $posts = get_post_meta( $post_id, $meta, true ); + $posts = get_post_meta( $post_id, $meta, false ); if ( isset( $posts ) && $posts ): - $posts = (array)unserialize( $posts ); foreach ( $posts as $post ): $parents = get_post_ancestors( $post ); $parents = array_combine( array_keys( $parents ), array_reverse( array_values( $parents ) ) ); diff --git a/player.php b/player.php index eecc3c85..a821528b 100644 --- a/player.php +++ b/player.php @@ -59,7 +59,7 @@ function sp_player_custom_columns( $column, $post_id ) { echo '—'; break; case 'sp_team': - sp_unserialized_posts( $post_id, 'sp_teams', '', '
' ); + sp_the_posts( $post_id, 'sp_team', '', '
' ); break; case 'sp_league': if ( get_the_terms ( $post_id, 'sp_league' ) )