Custom list
-
Hello!
Im try to make a custom player list with PHP and I want to get all players from one team. But it doesn’t show any post, even not all players.
There’s the code:
<?php $query = new WP_Query( array( 'post_type' => 'sp_player', 'tax_query' => array( array( 'taxonomy' => 'sp_team', 'field' => 'team', 'terms' => 197, ) ), ) ); if ( $query->have_posts() ) : ?> <?php while ( $query->have_posts() ) : $query->the_post(); $staff = new SP_Staff( $post->ID ); $current_teams = $staff->current_teams(); foreach ( $current_teams as $team ): $team_name = sp_get_team_name( $team, $abbreviate_teams ); if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>'; $teams[] = $team_name; endforeach; ?> <?php the_title(); ?> ( <? echo $team_name; ?> ) - <?php the_date('d.m.Y', '', ''); ?> <br/> <?php endwhile; wp_reset_postdata(); ?> <?php endif; ?>For the plugin authors: I want to sort by age my list, that’s why Im making a custom list.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Custom list’ is closed to new replies.