Add icons module

This commit is contained in:
Brian Miyaji
2015-09-17 12:33:16 +10:00
parent 98990c0995
commit d0e77dcb4d
16 changed files with 404 additions and 123 deletions

View File

@@ -47,6 +47,16 @@ class SP_Admin_Sports {
$id = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file );
$presets[ $id ] = $data;
$name = array_key_exists( 'name', $data ) ? __( $data['name'], 'sportspress' ) : $id;
// Conditionally append filename in parentheses for clarity
if ( false === strpos( str_replace( ' ', '', strtolower( $data['name'] ) ), str_replace( '-', '', $id ) ) ) {
if ( 4 < strlen( $id ) ) {
$name .= ' (' . ucfirst( $id ) . ')';
} else {
$name .= ' (' . strtoupper( $id ) . ')';
}
}
self::$options[ $slug ][ $id ] = $name;
}
asort( self::$options[ $slug ] );
@@ -153,6 +163,8 @@ class SP_Admin_Sports {
if ( isset( $performance['position'] ) ) {
wp_set_object_terms( $id, $performance['position'], 'sp_position', false );
}
update_post_meta( $id, 'sp_icon', sp_array_value( $performance, 'icon', null ) );
update_post_meta( $id, 'sp_color', sp_array_value( $performance, 'color', null ) );
$i ++;
}

View File

@@ -185,9 +185,11 @@
<td class="icon">
<?php
if ( has_post_thumbnail( $row->ID ) )
echo get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' );
$icon = get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' );
else
echo '&nbsp;';
$icon = '&nbsp;';
echo apply_filters( 'sportspress_performance_icon', $icon, $row->ID );
?>
</td>
<td class="row-title"><?php echo $row->post_title; ?></td>