Option to display photos in player list close #28
This commit is contained in:
@@ -109,6 +109,25 @@
|
|||||||
max-height: 2em;
|
max-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Player List */
|
||||||
|
.sp-player-list td {
|
||||||
|
line-height: 2em;
|
||||||
|
}
|
||||||
|
.sp-player-list .data-name .player-photo {
|
||||||
|
width: 2em;
|
||||||
|
height: 2em;
|
||||||
|
margin-right: 0.25em;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.sp-player-list .data-name .player-photo img {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 2em;
|
||||||
|
max-height: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Button */
|
/* Button */
|
||||||
.sp-button {
|
.sp-button {
|
||||||
border: none;
|
border: none;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package SportsPress/Admin/Meta_Boxes
|
* @package SportsPress/Admin/Meta_Boxes
|
||||||
* @version 1.0.2
|
* @version 1.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
@@ -37,6 +37,7 @@ class SP_Meta_Box_List_Data {
|
|||||||
* Admin edit table
|
* Admin edit table
|
||||||
*/
|
*/
|
||||||
public static function table( $columns = array(), $data = array(), $placeholders = array(), $adjustments = array() ) {
|
public static function table( $columns = array(), $data = array(), $placeholders = array(), $adjustments = array() ) {
|
||||||
|
$show_player_photo = get_option( 'sportspress_list_show_photos', 'no' ) == 'yes' ? true : false;
|
||||||
?>
|
?>
|
||||||
<ul class="subsubsub sp-table-bar">
|
<ul class="subsubsub sp-table-bar">
|
||||||
<li><a href="#sp-table-values" class="current"><?php _e( 'Values', 'sportspress' ); ?></a></li> |
|
<li><a href="#sp-table-values" class="current"><?php _e( 'Values', 'sportspress' ); ?></a></li> |
|
||||||
@@ -77,6 +78,7 @@ class SP_Meta_Box_List_Data {
|
|||||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||||
<td><?php echo ( $number ? $number : ' ' ); ?></td>
|
<td><?php echo ( $number ? $number : ' ' ); ?></td>
|
||||||
<td>
|
<td>
|
||||||
|
<?php if ( $show_player_photo ) echo get_the_post_thumbnail( $player_id, 'sportspress-fit-mini' ); ?>
|
||||||
<span class="sp-default-value">
|
<span class="sp-default-value">
|
||||||
<span class="sp-default-value-input"><?php echo $default_name; ?></span>
|
<span class="sp-default-value-input"><?php echo $default_name; ?></span>
|
||||||
<a class="dashicons dashicons-edit sp-edit" title="<?php _e( 'Edit', 'sportspress' ); ?>"></a>
|
<a class="dashicons dashicons-edit sp-edit" title="<?php _e( 'Edit', 'sportspress' ); ?>"></a>
|
||||||
|
|||||||
@@ -58,6 +58,14 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
|
|
||||||
array( 'title' => __( 'Player Lists', 'sportspress' ), 'type' => 'title', 'id' => 'list_options' ),
|
array( 'title' => __( 'Player Lists', 'sportspress' ), 'type' => 'title', 'id' => 'list_options' ),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Players', 'sportspress' ),
|
||||||
|
'desc' => __( 'Display photos', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_list_show_photos',
|
||||||
|
'default' => 'no',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Pagination', 'sportspress' ),
|
'title' => __( 'Pagination', 'sportspress' ),
|
||||||
'desc' => __( 'Paginate', 'sportspress' ),
|
'desc' => __( 'Paginate', 'sportspress' ),
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ $defaults = array(
|
|||||||
'orderby' => 'default',
|
'orderby' => 'default',
|
||||||
'order' => 'ASC',
|
'order' => 'ASC',
|
||||||
'show_all_players_link' => false,
|
'show_all_players_link' => false,
|
||||||
|
'show_player_photo' => get_option( 'sportspress_list_show_photos', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||||
@@ -116,13 +117,23 @@ foreach ( $groups as $group ):
|
|||||||
else:
|
else:
|
||||||
$output .= '<td class="data-number">' . sp_array_value( $row, 'number', ' ' ) . '</td>';
|
$output .= '<td class="data-number">' . sp_array_value( $row, 'number', ' ' ) . '</td>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
$name_class = '';
|
||||||
|
|
||||||
|
if ( $show_player_photo ):
|
||||||
|
if ( has_post_thumbnail( $player_id ) ):
|
||||||
|
$logo = get_the_post_thumbnail( $player_id, 'sportspress-fit-icon' );
|
||||||
|
$name = '<span class="player-photo">' . $logo . '</span>' . $name;
|
||||||
|
$name_class .= ' has-photo';
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
|
|
||||||
if ( $link_posts ):
|
if ( $link_posts ):
|
||||||
$permalink = get_post_permalink( $player_id );
|
$permalink = get_post_permalink( $player_id );
|
||||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$output .= '<td class="data-name">' . $name . '</td>';
|
$output .= '<td class="data-name' . $name_class . '">' . $name . '</td>';
|
||||||
|
|
||||||
if ( array_key_exists( 'team', $labels ) ):
|
if ( array_key_exists( 'team', $labels ) ):
|
||||||
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
|
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user