1st commit for icon support to sp_statistic CPT
This commit is contained in:
@@ -40,6 +40,7 @@ class SP_Admin_CPT_Statistic extends SP_Admin_CPT {
|
|||||||
public function edit_columns( $existing_columns ) {
|
public function edit_columns( $existing_columns ) {
|
||||||
$columns = array(
|
$columns = array(
|
||||||
'cb' => '<input type="checkbox" />',
|
'cb' => '<input type="checkbox" />',
|
||||||
|
'sp_icon' => __( 'Icon', 'sportspress' ),
|
||||||
'title' => __( 'Label', 'sportspress' ),
|
'title' => __( 'Label', 'sportspress' ),
|
||||||
'sp_key' => __( 'Key', 'sportspress' ),
|
'sp_key' => __( 'Key', 'sportspress' ),
|
||||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||||
@@ -55,6 +56,9 @@ class SP_Admin_CPT_Statistic extends SP_Admin_CPT {
|
|||||||
*/
|
*/
|
||||||
public function custom_columns( $column, $post_id ) {
|
public function custom_columns( $column, $post_id ) {
|
||||||
switch ( $column ):
|
switch ( $column ):
|
||||||
|
case 'sp_icon':
|
||||||
|
echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : '';
|
||||||
|
break;
|
||||||
case 'sp_key':
|
case 'sp_key':
|
||||||
global $post;
|
global $post;
|
||||||
echo $post->post_name;
|
echo $post->post_name;
|
||||||
|
|||||||
@@ -303,6 +303,9 @@ class SP_Admin_Meta_Boxes {
|
|||||||
|
|
||||||
remove_meta_box( 'postimagediv', 'sp_performance', 'side' );
|
remove_meta_box( 'postimagediv', 'sp_performance', 'side' );
|
||||||
add_meta_box( 'postimagediv', __( 'Icon', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_performance', 'side', 'low' );
|
add_meta_box( 'postimagediv', __( 'Icon', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_performance', 'side', 'low' );
|
||||||
|
|
||||||
|
remove_meta_box( 'postimagediv', 'sp_statistic', 'side' );
|
||||||
|
add_meta_box( 'postimagediv', __( 'Icon', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_statistic', 'side', 'low' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ $columns = get_option( 'sportspress_player_columns', 'auto' );
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||||
|
<th class="icon" scope="col"><?php _e( 'Icon', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Decimal Places', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Decimal Places', 'sportspress' ); ?></th>
|
||||||
<th scope="col"><?php _e( 'Category', 'sportspress' ); ?></th>
|
<th scope="col"><?php _e( 'Category', 'sportspress' ); ?></th>
|
||||||
@@ -391,6 +392,16 @@ $columns = get_option( 'sportspress_player_columns', 'auto' );
|
|||||||
?>
|
?>
|
||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
|
<td class="icon">
|
||||||
|
<?php
|
||||||
|
if ( has_post_thumbnail( $row->ID ) )
|
||||||
|
$icon = get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' );
|
||||||
|
else
|
||||||
|
$icon = ' ';
|
||||||
|
|
||||||
|
echo apply_filters( 'sportspress_performance_icon', $icon, $row->ID );
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
||||||
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
||||||
<td><?php echo sp_get_post_section( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_section( $row->ID ); ?></td>
|
||||||
|
|||||||
@@ -392,6 +392,9 @@ class SP_Post_types {
|
|||||||
'search_items' => __( 'Search', 'sportspress' ),
|
'search_items' => __( 'Search', 'sportspress' ),
|
||||||
'not_found' => __( 'No results found.', 'sportspress' ),
|
'not_found' => __( 'No results found.', 'sportspress' ),
|
||||||
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
||||||
|
'set_featured_image' => __( 'Select Icon', 'sportspress' ),
|
||||||
|
'remove_featured_image' => __( 'Remove icon', 'sportspress' ),
|
||||||
|
'use_featured_image' => __( 'Add icon', 'sportspress' ),
|
||||||
),
|
),
|
||||||
'public' => false,
|
'public' => false,
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class SportsPress_Icons {
|
|||||||
|
|
||||||
// Bypass if not performance post type
|
// Bypass if not performance post type
|
||||||
$post_type = get_post_type( $id );
|
$post_type = get_post_type( $id );
|
||||||
if ( 'sp_performance' !== $post_type ) return $content;
|
if ( 'sp_performance' !== $post_type && 'sp_statistic' !== $post_type ) return $content;
|
||||||
|
|
||||||
// Detect if image uploaded
|
// Detect if image uploaded
|
||||||
$is_uploaded = isset( $_POST['thumbnail_id'] );
|
$is_uploaded = isset( $_POST['thumbnail_id'] );
|
||||||
|
|||||||
Reference in New Issue
Block a user