Consolidate custom post type management actions
This commit is contained in:
93
actions.php
93
actions.php
@@ -10,6 +10,99 @@ function sp_after_theme_setup() {
|
||||
}
|
||||
add_action( 'after_theme_setup', 'sp_after_theme_setup' );
|
||||
|
||||
function sp_manage_posts_custom_column( $column, $post_id ) {
|
||||
switch ( $column ):
|
||||
case 'sp_icon':
|
||||
the_post_thumbnail( 'sp_icon' );
|
||||
break;
|
||||
case 'sp_position':
|
||||
get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : print '—';
|
||||
break;
|
||||
case 'sp_team':
|
||||
get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '<br />' ) : print '—';
|
||||
break;
|
||||
case 'sp_league':
|
||||
get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : print '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : print '—';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
get_the_terms ( $post_id, 'sp_sponsor' ) ? the_terms( $post_id, 'sp_sponsor' ) : print '—';
|
||||
break;
|
||||
case 'sp_kickoff':
|
||||
echo get_the_date ( get_option ( 'date_format' ) ) . '<br />' . get_the_time ( get_option ( 'time_format' ) );
|
||||
break;
|
||||
case 'sp_address':
|
||||
echo get_post_meta( $post_id, 'sp_address', true );
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_manage_posts_custom_column', 10, 2 );
|
||||
add_action( 'manage_pages_custom_column', 'sp_manage_posts_custom_column', 10, 2 );
|
||||
|
||||
function sp_restrict_manage_posts() {
|
||||
global $typenow, $wp_query;
|
||||
switch ( $typenow ):
|
||||
case 'sp_player':
|
||||
|
||||
// Teams
|
||||
$selected = isset( $_REQUEST['sp_team'] ) ? $_REQUEST['sp_team'] : null;
|
||||
$args = array(
|
||||
'show_option_none' => sprintf( __( 'All %s', 'sportspress' ), __( 'Teams', 'sportspress' ) ),
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team',
|
||||
'selected' => $selected
|
||||
);
|
||||
wp_dropdown_pages( $args );
|
||||
|
||||
// Positions
|
||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_position',
|
||||
'name' => 'sp_position',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
|
||||
endswitch;
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_restrict_manage_posts' );
|
||||
|
||||
function sp_nonce() {
|
||||
echo '<input type="hidden" name="sportspress_nonce" id="sportspress_nonce" value="' . wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
|
||||
}
|
||||
|
||||
24
calendar.php
24
calendar.php
@@ -27,30 +27,6 @@ function sp_calendar_edit_columns( $columns ) {
|
||||
}
|
||||
add_filter( 'manage_edit-sp_calendar_columns', 'sp_calendar_edit_columns' );
|
||||
|
||||
function sp_calendar_custom_columns( $column ) {
|
||||
global $post, $post_id, $typenow;
|
||||
if ( $typenow == 'sp_calendar' ):
|
||||
switch ($column):
|
||||
case 'sp_team':
|
||||
echo 'TEAMS';
|
||||
break;
|
||||
case 'sp_league':
|
||||
if ( get_the_terms ( $post_id, 'sp_league' ) )
|
||||
the_terms( $post_id, 'sp_league' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
if ( get_the_terms ( $post_id, 'sp_season' ) )
|
||||
the_terms( $post_id, 'sp_season' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_calendar_custom_columns' );
|
||||
|
||||
function sp_calendar_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_calendar' ) {
|
||||
|
||||
33
event.php
33
event.php
@@ -182,39 +182,6 @@ function sp_event_edit_columns( $columns ) {
|
||||
}
|
||||
add_filter( 'manage_edit-sp_event_columns', 'sp_event_edit_columns' );
|
||||
|
||||
function sp_event_custom_columns( $column, $post_id ) {
|
||||
global $typenow;
|
||||
if ( $typenow == 'sp_event' ):
|
||||
switch ( $column ):
|
||||
case 'sp_team':
|
||||
sp_the_posts( $post_id, 'sp_team', '', '<br />' );
|
||||
break;
|
||||
case 'sp_league':
|
||||
if ( get_the_terms ( $post_id, 'sp_league' ) )
|
||||
the_terms( $post_id, 'sp_league' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
if ( get_the_terms ( $post_id, 'sp_season' ) )
|
||||
the_terms( $post_id, 'sp_season' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
if ( get_the_terms ( $post_id, 'sp_sponsor' ) )
|
||||
the_terms( $post_id, 'sp_sponsor' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_kickoff':
|
||||
echo get_the_date ( get_option ( 'date_format' ) ) . '<br />' . get_the_time ( get_option ( 'time_format' ) );
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_event_custom_columns', 10, 2 );
|
||||
|
||||
function sp_event_edit_sortable_columns( $columns ) {
|
||||
$columns['sp_kickoff'] = 'sp_kickoff';
|
||||
return $columns;
|
||||
|
||||
74
helpers.php
74
helpers.php
@@ -65,13 +65,14 @@ 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 = '' ) {
|
||||
echo $before;
|
||||
if ( ! isset( $post_id ) )
|
||||
global $post_id;
|
||||
$posts = get_post_meta( $post_id, $meta, false );
|
||||
if ( isset( $posts ) && $posts ):
|
||||
if ( isset( $posts ) && $posts && is_array( $posts ) ):
|
||||
foreach ( $posts as $post ):
|
||||
$parents = get_post_ancestors( $post );
|
||||
$parents = array_combine( array_keys( $parents ), array_reverse( array_values( $parents ) ) );
|
||||
@@ -84,8 +85,6 @@ if ( ! function_exists( 'sp_the_posts' ) ) {
|
||||
if ( $post != end( $posts ) )
|
||||
echo $sep;
|
||||
endforeach;
|
||||
else:
|
||||
echo '—';
|
||||
endif;
|
||||
echo $after;
|
||||
}
|
||||
@@ -109,47 +108,44 @@ if ( ! function_exists( 'sp_team_logo' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sp_team_checklist' ) ) {
|
||||
function sp_team_checklist( $post_id = null ) {
|
||||
if ( ! isset( $post_id ) )
|
||||
global $post_id;
|
||||
$selected = (array)get_post_meta( $post_id, 'sp_team', false );
|
||||
$teams = get_pages( array( 'post_type' => 'sp_team') );
|
||||
foreach ( $teams as $team ):
|
||||
$parents = get_post_ancestors( $team );
|
||||
?>
|
||||
<li>
|
||||
<?php echo str_repeat( '<ul><li>', sizeof( $parents ) ); ?>
|
||||
<label class="selectit">
|
||||
<input type="checkbox" value="<?php echo $team->ID; ?>" name="sportspress[sp_team][]"<?php if ( in_array( $team->ID, $selected ) ) echo ' checked="checked"'; ?>>
|
||||
<?php echo $team->post_title; ?>
|
||||
</label>
|
||||
<?php echo str_repeat( '</li></ul>', sizeof( $parents ) ); ?>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'sp_team_select_html' ) ) {
|
||||
function sp_team_select_html( $post_id = null ) {
|
||||
if ( ! function_exists( 'sp_post_checklist' ) ) {
|
||||
function sp_post_checklist( $post_id = null, $meta = 'post', $add_new_item = true ) {
|
||||
if ( ! isset( $post_id ) )
|
||||
global $post_id;
|
||||
$obj = get_post_type_object( $meta );
|
||||
?>
|
||||
<div id="posttype-sp_team" class="posttypediv">
|
||||
<div id="sp_team-all" class="wp-tab-panel">
|
||||
<input type="hidden" value="0" name="sportspress[sp_team]" />
|
||||
<div id="posttype-<?php echo $meta; ?>" class="posttypediv">
|
||||
<div id="<?php echo $meta; ?>-all" class="wp-tab-panel">
|
||||
<input type="hidden" value="0" name="sportspress[<?php echo $meta; ?>]" />
|
||||
<ul class="categorychecklist form-no-clear">
|
||||
<?php sp_team_checklist( $post_id ); ?>
|
||||
<?php
|
||||
$selected = (array)get_post_meta( $post_id, $meta, false );
|
||||
$teams = get_pages( array( 'post_type' => $meta) );
|
||||
foreach ( $teams as $team ):
|
||||
$parents = get_post_ancestors( $team );
|
||||
?>
|
||||
<li>
|
||||
<?php echo str_repeat( '<ul><li>', sizeof( $parents ) ); ?>
|
||||
<label class="selectit">
|
||||
<input type="checkbox" value="<?php echo $team->ID; ?>" name="sportspress[<?php echo $meta; ?>][]"<?php if ( in_array( $team->ID, $selected ) ) echo ' checked="checked"'; ?>>
|
||||
<?php echo $team->post_title; ?>
|
||||
</label>
|
||||
<?php echo str_repeat( '</li></ul>', sizeof( $parents ) ); ?>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="sp_team-adder">
|
||||
<h4>
|
||||
<a title="<?php echo sprintf( esc_attr__( 'Add New %s', 'sportspress' ), esc_attr__( 'Team', 'sportspress' ) ); ?>" href="<?php echo admin_url( 'post-new.php?post_type=sp_team' ); ?>" target="_blank">
|
||||
+ <?php echo sprintf( __( 'Add New %s', 'sportspress' ), __( 'Team', 'sportspress' ) ); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<?php if ( $add_new_item ): ?>
|
||||
<div id="<?php echo $meta; ?>-adder">
|
||||
<h4>
|
||||
<a title="<?php echo sprintf( esc_attr__( 'Add New %s', 'sportspress' ), esc_attr__( 'Team', 'sportspress' ) ); ?>" href="<?php echo admin_url( 'post-new.php?post_type=' . $meta ); ?>" target="_blank">
|
||||
+ <?php echo sprintf( __( 'Add New %s', 'sportspress' ), $obj->labels->singular_name ); ?>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
96
player.php
96
player.php
@@ -24,17 +24,16 @@ function sp_player_meta_init() {
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' );
|
||||
add_meta_box( 'sp_profilediv', __( 'Profile', 'sportspress' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' );
|
||||
}
|
||||
function sp_player_team_meta( $post, $metabox ) {
|
||||
global $post_id;
|
||||
sp_team_select_html( $post_id );
|
||||
function sp_player_team_meta( $post ) {
|
||||
sp_post_checklist( $post->ID, 'sp_team', true );
|
||||
sp_nonce();
|
||||
}
|
||||
|
||||
function sp_player_profile_meta( $post, $metabox ) {
|
||||
function sp_player_profile_meta( $post ) {
|
||||
wp_editor( $post->post_content, 'content' );
|
||||
}
|
||||
|
||||
function sp_player_edit_columns( $columns ) {
|
||||
function sp_player_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
@@ -47,91 +46,4 @@ function sp_player_edit_columns( $columns ) {
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_player_columns', 'sp_player_edit_columns' );
|
||||
|
||||
function sp_player_custom_columns( $column, $post_id ) {
|
||||
global $post, $typenow;
|
||||
if ( $typenow == 'sp_player' ):
|
||||
switch ($column):
|
||||
case 'sp_position':
|
||||
if ( get_the_terms ( $post_id, 'sp_position' ) )
|
||||
the_terms( $post_id, 'sp_position' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_team':
|
||||
sp_the_posts( $post_id, 'sp_team', '', '<br />' );
|
||||
break;
|
||||
case 'sp_league':
|
||||
if ( get_the_terms ( $post_id, 'sp_league' ) )
|
||||
the_terms( $post_id, 'sp_league' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
if ( get_the_terms ( $post_id, 'sp_season' ) )
|
||||
the_terms( $post_id, 'sp_season' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
if ( get_the_terms ( $post_id, 'sp_sponsor' ) )
|
||||
the_terms( $post_id, 'sp_sponsor' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_player_custom_columns', 10, 2 );
|
||||
|
||||
function sp_player_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_player' ) {
|
||||
|
||||
// Positions
|
||||
$selected = isset( $_REQUEST['sp_position'] ) ? $_REQUEST['sp_position'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Positions', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_position',
|
||||
'name' => 'sp_position',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Leagues
|
||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_league',
|
||||
'name' => 'sp_league',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Seasons
|
||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Seasons', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_season',
|
||||
'name' => 'sp_season',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
echo PHP_EOL;
|
||||
|
||||
// Sponsors
|
||||
$selected = isset( $_REQUEST['sp_sponsor'] ) ? $_REQUEST['sp_sponsor'] : null;
|
||||
$args = array(
|
||||
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sponsors', 'sportspress' ) ),
|
||||
'taxonomy' => 'sp_sponsor',
|
||||
'name' => 'sp_sponsor',
|
||||
'selected' => $selected
|
||||
);
|
||||
sp_dropdown_taxonomies( $args );
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'restrict_manage_posts', 'sp_player_request_filter_dropdowns' );
|
||||
?>
|
||||
32
staff.php
32
staff.php
@@ -26,7 +26,7 @@ function sp_staff_meta_init() {
|
||||
}
|
||||
function sp_staff_team_meta( $post, $metabox ) {
|
||||
global $post_id;
|
||||
sp_team_select_html( $post_id );
|
||||
sp_post_checklist( $post_id, 'sp_team', true );
|
||||
sp_nonce();
|
||||
}
|
||||
|
||||
@@ -47,36 +47,6 @@ function sp_staff_edit_columns( $columns ) {
|
||||
}
|
||||
add_filter( 'manage_edit-sp_staff_columns', 'sp_staff_edit_columns' );
|
||||
|
||||
function sp_staff_custom_columns( $column, $post_id ) {
|
||||
global $post, $typenow;
|
||||
if ( $typenow == 'sp_staff' ):
|
||||
switch ($column):
|
||||
case 'sp_position':
|
||||
if ( get_the_terms ( $post_id, 'sp_position' ) )
|
||||
the_terms( $post_id, 'sp_position' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_team':
|
||||
sp_the_posts( $post_id, 'sp_team', '', '<br />' );
|
||||
break;
|
||||
case 'sp_league':
|
||||
if ( get_the_terms ( $post_id, 'sp_league' ) )
|
||||
the_terms( $post_id, 'sp_league' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
if ( get_the_terms ( $post_id, 'sp_season' ) )
|
||||
the_terms( $post_id, 'sp_season' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_staff_custom_columns', 10, 2 );
|
||||
|
||||
function sp_staff_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_staff' ) {
|
||||
|
||||
24
table.php
24
table.php
@@ -27,30 +27,6 @@ function sp_table_edit_columns( $columns ) {
|
||||
}
|
||||
add_filter( 'manage_edit-sp_table_columns', 'sp_table_edit_columns' );
|
||||
|
||||
function sp_table_custom_columns( $column ) {
|
||||
global $post, $post_id, $typenow;
|
||||
if ( $typenow == 'sp_table' ):
|
||||
switch ($column):
|
||||
case 'sp_team':
|
||||
echo 'TEAMS';
|
||||
break;
|
||||
case 'sp_league':
|
||||
if ( get_the_terms ( $post_id, 'sp_league' ) )
|
||||
the_terms( $post_id, 'sp_league' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
if ( get_the_terms ( $post_id, 'sp_season' ) )
|
||||
the_terms( $post_id, 'sp_season' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_table_custom_columns' );
|
||||
|
||||
function sp_table_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_table' ) {
|
||||
|
||||
30
team.php
30
team.php
@@ -36,36 +36,6 @@ function sp_team_edit_columns($columns) {
|
||||
}
|
||||
add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' );
|
||||
|
||||
function sp_team_custom_columns( $column ) {
|
||||
global $post, $post_id, $typenow;
|
||||
if ( $typenow == 'sp_team' ):
|
||||
switch ( $column ):
|
||||
case 'sp_icon':
|
||||
the_post_thumbnail( 'sp_icon' );
|
||||
break;
|
||||
case 'sp_league':
|
||||
if ( get_the_terms ( $post_id, 'sp_league' ) )
|
||||
the_terms( $post_id, 'sp_league' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
if ( get_the_terms ( $post_id, 'sp_season' ) )
|
||||
the_terms( $post_id, 'sp_season' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_sponsor':
|
||||
if ( get_the_terms ( $post_id, 'sp_sponsor' ) )
|
||||
the_terms( $post_id, 'sp_sponsor' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_pages_custom_column', 'sp_team_custom_columns' );
|
||||
|
||||
function sp_team_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_team' ) {
|
||||
|
||||
18
venue.php
18
venue.php
@@ -26,24 +26,6 @@ function sp_venue_edit_columns( $columns ) {
|
||||
}
|
||||
add_filter( 'manage_edit-sp_venue_columns', 'sp_venue_edit_columns' );
|
||||
|
||||
function sp_venue_custom_columns( $column, $post_id ) {
|
||||
global $typenow;
|
||||
if ( $typenow == 'sp_venue' ):
|
||||
switch ( $column ):
|
||||
case 'sp_sponsor':
|
||||
if ( get_the_terms ( $post_id, 'sp_sponsor' ) )
|
||||
the_terms( $post_id, 'sp_sponsor' );
|
||||
else
|
||||
echo '—';
|
||||
break;
|
||||
case 'sp_address':
|
||||
echo get_post_meta( $post_id, 'sp_address', true );
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
}
|
||||
add_action( 'manage_posts_custom_column', 'sp_venue_custom_columns', 10, 2 );
|
||||
|
||||
function sp_venue_request_filter_dropdowns() {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'sp_venue' ) {
|
||||
|
||||
Reference in New Issue
Block a user