Reorganize and add statistics post types

This commit is contained in:
ThemeBoy
2013-11-25 23:29:04 +11:00
parent 3d492f4d80
commit 7aeec083b8
24 changed files with 330 additions and 89 deletions

View File

@@ -12,8 +12,9 @@ function sp_event_cpt_init() {
'supports' => array( 'title', 'author', 'comments' ),
'register_meta_box_cb' => 'sp_event_meta_init',
'rewrite' => array( 'slug' => 'event' ),
'menu_position' => 44
'menu_position' => 42
);
$args['labels']['menu_name'] = __( 'SportsPress', 'sportspress' );
register_post_type( 'sp_event', $args );
}
add_action( 'init', 'sp_event_cpt_init' );
@@ -31,9 +32,9 @@ function sp_event_meta_init() {
remove_meta_box( 'submitdiv', 'sp_event', 'side' );
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_event_team_meta', 'sp_event', 'side', 'high' );
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sp_event_article_meta', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_resultsdiv', __( 'Results', 'sportspress' ), 'sp_event_results_meta', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_event_stats_meta', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_resultsdiv', __( 'Results', 'sportspress' ), 'sp_event_results_meta', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sp_event_article_meta', 'sp_event', 'normal', 'high' );
}
function sp_event_team_meta( $post ) {

View File

@@ -0,0 +1,24 @@
<?php
function sp_metric_cpt_init() {
$name = __( 'Metrics', 'sportspress' );
$singular_name = __( 'Metric', 'sportspress' );
$lowercase_name = __( 'metrics', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => false,
'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ),
'register_meta_box_cb' => 'sp_metric_meta_init',
'rewrite' => array( 'slug' => 'metric' ),
'show_in_menu' => 'edit.php?post_type=sp_player'
);
register_post_type( 'sp_metric', $args );
}
add_action( 'init', 'sp_metric_cpt_init' );
function sp_metric_meta_init() {
}
?>

View File

@@ -12,7 +12,7 @@ function sp_player_cpt_init() {
'supports' => array( 'title', 'author', 'thumbnail' ),
'register_meta_box_cb' => 'sp_player_meta_init',
'rewrite' => array( 'slug' => 'player' ),
'menu_position' => 45
'menu_position' => 44
);
register_post_type( 'sp_player', $args );
}

View File

@@ -12,7 +12,7 @@ function sp_staff_cpt_init() {
'supports' => array( 'title', 'author', 'thumbnail' ),
'register_meta_box_cb' => 'sp_staff_meta_init',
'rewrite' => array( 'slug' => 'staff' ),
'menu_position' => 46
'menu_position' => 45
);
register_post_type( 'sp_staff', $args );
}

100
admin/post-types/stat.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
function sp_stat_cpt_init() {
$name = __( 'Statistics', 'sportspress' );
$singular_name = __( 'Statistic', 'sportspress' );
$lowercase_name = __( 'statistics', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => false,
'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ),
'register_meta_box_cb' => 'sp_stat_meta_init',
'rewrite' => array( 'slug' => 'stat' ),
'show_in_menu' => 'edit.php?post_type=sp_team'
);
register_post_type( 'sp_stat', $args );
}
add_action( 'init', 'sp_stat_cpt_init' );
function sp_stat_edit_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_sport' => __( 'Sport', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
);
return $columns;
}
add_filter( 'manage_edit-sp_stat_columns', 'sp_stat_edit_columns' );
function sp_stat_meta_init() {
add_meta_box( 'sp_equationdiv', __( 'Equation', 'sportspress' ), 'sp_stat_equation_meta', 'sp_stat', 'normal', 'high' );
}
function sp_stat_equation_meta( $post ) {
$args = array(
'post_type' => 'sp_stat',
'numberposts' => -1,
'posts_per_page' => -1,
'exclude' => $post->ID
);
$sports = get_the_terms( $post->ID, 'sp_sport' );
if ( ! empty( $sports ) ):
$terms = array();
foreach ( $sports as $sport ):
$terms[] = $sport->slug;
endforeach;
$args['tax_query'] = array(
array(
'taxonomy' => 'sp_sport',
'field' => 'slug',
'terms' => $terms
)
);
endif;
$stats = get_posts( $args );
?>
<div>
<p class="sp-equation-selector">
<select data-remove-text="<?php _e( 'Remove', 'sportspress' ); ?>">
<option value=""><?php _e( 'Select', 'sportspress' ); ?></option>
<optgroup label="<?php _e( 'Events', 'sportspress' ); ?>">
<option value="wins"><?php _e( 'Wins', 'sportspress' ); ?></option>
<option value="draws"><?php _e( 'Draws', 'sportspress' ); ?></option>
<option value="ties"><?php _e( 'Ties', 'sportspress' ); ?></option>
<option value="losses"><?php _e( 'Losses', 'sportspress' ); ?></option>
</optgroup>
<optgroup label="<?php _e( 'Statistics', 'sportspress' ); ?>">
<?php foreach ( $stats as $stat ): ?>
<option value="<?php echo $stat->post_name; ?>"><?php echo $stat->post_title; ?></option>
<?php endforeach; ?>
</optgroup>
<optgroup label="<?php _e( 'Operators', 'sportspress' ); ?>">
<option value="+">&plus;</option>
<option value="-">&minus;</option>
<option value="X">&times;</option>
<option value="/">&divide;</option>
<option value="(">(</option>
<option value=")">)</option>
</optgroup>
<optgroup label="<?php _e( 'Constants', 'sportspress' ); ?>">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</optgroup>
</select>
</p>
</div>
<?php
}
?>

View File

@@ -1,5 +1,5 @@
<?php
function sp_div_tax_init() {
function sp_div_term_init() {
$name = __( 'Divisions', 'sportspress' );
$singular_name = __( 'Division', 'sportspress' );
$lowercase_name = __( 'divisions', 'sportspress' );
@@ -14,5 +14,5 @@ function sp_div_tax_init() {
);
register_taxonomy( 'sp_div', $object_type, $args );
}
add_action( 'init', 'sp_div_tax_init' );
add_action( 'init', 'sp_div_term_init' );
?>

View File

@@ -1,5 +1,5 @@
<?php
function sp_pos_tax_init() {
function sp_pos_term_init() {
$name = __( 'Positions', 'sportspress' );
$singular_name = __( 'Position', 'sportspress' );
$lowercase_name = __( 'position', 'sportspress' );
@@ -10,9 +10,11 @@ function sp_pos_tax_init() {
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'position' ),
'rewrite' => array( 'slug' => 'position' )
);
register_taxonomy( 'sp_pos', $object_type, $args );
register_taxonomy_for_object_type( 'sp_pos', 'sp_player' );
register_taxonomy_for_object_type( 'sp_pos', 'sp_staff' );
}
add_action( 'init', 'sp_pos_tax_init' );
add_action( 'init', 'sp_pos_term_init' );
?>

18
admin/terms/sport.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
function sp_sport_term_init() {
$name = __( 'Sports', 'sportspress' );
$singular_name = __( 'Sport', 'sportspress' );
$lowercase_name = __( 'sport', 'sportspress' );
$object_type = array( 'sp_stat', 'sp_metric' );
$labels = sp_tax_labels( $name, $singular_name, $lowercase_name );
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'sport' )
);
register_taxonomy( 'sp_sport', $object_type, $args );
}
add_action( 'init', 'sp_sport_term_init' );
?>

View File

@@ -7,7 +7,7 @@
#adminmenu #menu-posts-sp_list div.wp-menu-image,
#adminmenu #menu-posts-sp_tournament div.wp-menu-image,
#adminmenu #menu-posts-sp_venue div.wp-menu-image {
background-image: url(images/menu.png);
background-image: url(../images/menu.png);
background-repeat: no-repeat;
background-position: 1px -33px;
}

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -63,4 +63,13 @@ jQuery(document).ready(function($){
});
}
// Equation selector
$('.sp-equation-selector select').change(function() {
if($(this).val() != '') {
$(this).before($(this).clone().val($(this).val())).val('').siblings().change(function() {
if($(this).val() == '') $(this).remove();
}).find('option:first').text($(this).attr('data-remove-text'));
}
});
});

View File

@@ -0,0 +1,63 @@
<?php
add_shortcode( 'sp_table', 'sp_table_shortcode' );
function sp_table_shortcode( $atts, $content = null, $code = "" ) {
global $sp_table_stats_labels;
extract( shortcode_atts( array(
'limit' => 0,
'div' => 0
), $atts ) );
// Get all teams in the division
$args = array(
'post_type' => 'sp_team',
'numberposts' => -1,
'posts_per_page' => -1,
'tax_query' => array()
);
if ( $div ) {
$args['tax_query'][] = array(
'taxonomy' => 'sp_div',
'terms' => $div,
'field' => 'term_id'
);
}
$teams = get_posts( $args );
// Check if there are any teams
$size = sizeof( $teams );
if ( $size == 0 )
return false;
// Generate table
$output = '<table class="sp_table">
<thead>
<tr>
<th class="pos">' . __( 'Position', 'sportspress' ) . '</th>';
foreach( $stats as $stat ) {
$output .= '<th class="' . $stat . '">' . $sp_table_stats_labels[$stat] . '</th>';
}
$output .=
'</tr>
</thead>
<tbody>';
// insert rows
$rownum = 0;
foreach ( $teams as $club ) {
$rownum ++;
$club_stats = $club->tb_stats;
$output .=
'<tr class="' . ( $center == $club->ID ? 'highlighted ' : '' ) . ( $rownum % 2 == 0 ? 'even' : 'odd' ) . ( $rownum == $limit ? ' last' : '' ) . '">';
$output .= '<td class="club"><span class="pos">' . $club->place . '</span> ' . ( $club_links ? '<a class="tb-club-link" href="' . get_permalink( $club->ID ) . '">' : '' ) . get_the_post_thumbnail( $club->ID, 'crest-small', array( 'title' => $club->post_title, 'class' => 'crest' ) ) . ' <span class="name">' . $club->post_title . ( $club_links ? '</a>' : '' ) . '</span></td>';
foreach( $stats as $stat ) {
$output .= '<td class="' . $stat . '">' . $club_stats[$stat] . '</td>';
}
}
$output.=
'</tbody>
</table>';
if ( isset( $linkpage ) )
$output .= '<a href="' . get_page_link( $linkpage ) . '" class="tb_view_all">' . $linktext . '</a>';
$output .= '</section>';
return $output;
}
?>

View File

@@ -1,7 +0,0 @@
<?php
function sp_admin_enqueue_scripts() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'sportspress-admin', plugin_dir_url( __FILE__ ) .'/sportspress-admin.js', array( 'jquery' ), time(), true );
}
add_action( 'admin_enqueue_scripts', 'sp_admin_enqueue_scripts' );
?>

View File

@@ -31,6 +31,9 @@ function sp_manage_posts_custom_column( $column, $post_id ) {
$result = get_post_meta( $post_id, 'sp_result', false );
echo get_post_meta ( $post_id, 'sp_team' ) ? sp_the_posts( $post_id, 'sp_team', '', '<br />', $result, ( empty( $result ) ? ' — ' : ' ' ) ) : '—';
break;
case 'sp_sport':
echo get_the_terms ( $post_id, 'sp_sport' ) ? preg_replace('#<a.*?>.*?</a>#i', '', sp_the_plain_terms( $post_id, 'sp_sport' ) ) : '—';
break;
case 'sp_player':
echo sp_the_posts( $post_id, 'sp_player' );
break;
@@ -64,7 +67,7 @@ function sp_restrict_manage_posts() {
'name' => 'sp_team',
'selected' => $selected
);
wp_dropdown_pages( $args );
// wp_dropdown_pages( $args );
endif;
if ( in_array( $typenow, array( 'sp_player', 'sp_staff' ) ) ):
$selected = isset( $_REQUEST['sp_pos'] ) ? $_REQUEST['sp_pos'] : null;
@@ -86,6 +89,16 @@ function sp_restrict_manage_posts() {
);
sp_dropdown_taxonomies( $args );
endif;
if ( in_array( $typenow, array( 'sp_stat', 'sp_metric' ) ) ):
$selected = isset( $_REQUEST['sp_sport'] ) ? $_REQUEST['sp_sport'] : null;
$args = array(
'show_option_all' => sprintf( __( 'All %s', 'sportspress' ), __( 'Sports', 'sportspress' ) ),
'taxonomy' => 'sp_sport',
'name' => 'sp_sport',
'selected' => $selected
);
sp_dropdown_taxonomies( $args );
endif;
}
add_action( 'restrict_manage_posts', 'sp_restrict_manage_posts' );
@@ -149,26 +162,6 @@ function sp_save_post( $post_id ) {
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
break;
endswitch;
/*
foreach ( $sportspress as $key => $value ):
delete_post_meta( $post_id, $key );
if ( is_array( $value ) ):
if ( sp_get_array_depth( $value ) >= 3 ):
add_post_meta( $post_id, $key, $value, false );
else:
$values = new RecursiveIteratorIterator( new RecursiveArrayIterator( $value ) );
foreach ( $values as $value ):
add_post_meta( $post_id, $key, $value, false );
endforeach;
endif;
else:
update_post_meta( $post_id, $key, $value );
endif;
endforeach;
*/
}
add_action( 'save_post', 'sp_save_post' );
?>

View File

@@ -33,4 +33,13 @@ function sp_admin_post_thumbnail_html( $translated_text, $post_id ) {
return $translated_text;
}
add_filter( 'admin_post_thumbnail_html', 'sp_admin_post_thumbnail_html', 10, 2 );
function sportspress_the_content( $content ) {
if ( is_singular( 'sp_team' ) && in_the_loop() ) {
// change stuff
$content .= '<p>' . do_shortcode('[sp_table]') . '</p>';
}
return $content;
}
add_filter('the_content', 'sportspress_the_content');
?>

View File

@@ -70,7 +70,7 @@ if ( !function_exists( 'sp_cpt_labels' ) ) {
$labels = array(
'name' => $name,
'singular_name' => $singular_name,
'all_items' => $is_submenu ? $name : sprintf( __( 'All %s', 'sportspress' ), $name ),
'all_items' => $name,
'add_new_item' => sprintf( __( 'Add New %s', 'sportspress' ), $singular_name ),
'edit_item' => sprintf( __( 'Edit %s', 'sportspress' ), $singular_name ),
'new_item' => sprintf( __( 'New %s', 'sportspress' ), $singular_name ),
@@ -141,7 +141,7 @@ if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
printf( '<option value="-1">%s</option>', $args['show_option_none'] );
}
foreach ( $terms as $term ) {
printf( '<option value="%s" %s>%s</option>', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name );
printf( '<option value="%s" %s>%s</option>', $term->slug, selected( true, $args['selected'] == $term->slug, false ), $term->name );
}
print( '</select>' );
}
@@ -193,6 +193,17 @@ if ( !function_exists( 'sp_the_posts' ) ) {
}
}
if ( !function_exists( 'sp_the_plain_terms' ) ) {
function sp_the_plain_terms( $id, $taxonomy ) {
$terms = get_the_terms( $id, $taxonomy );
$arr = array();
foreach( $terms as $term ):
$arr[] = $term->name;
endforeach;
echo implode( ', ', $arr );
}
}
if ( !function_exists( 'sp_post_checklist' ) ) {
function sp_post_checklist( $post_id = null, $meta = 'post', $display = 'block', $filter = null, $index = null ) {
if ( ! isset( $post_id ) )
@@ -249,7 +260,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
if ( !function_exists( 'sp_get_eos_rows' ) ) {
function sp_get_eos_rows( $raw ) {
$raw = str_replace( array( "\r\n", ' ' ), array( "\n", '' ), $raw );
$output = explode( "\r\n", $raw );
$output = explode( "\n", $raw );
return $output;
}
}
@@ -257,7 +268,7 @@ if ( !function_exists( 'sp_get_eos_rows' ) ) {
if ( !function_exists( 'sp_get_eos_keys' ) ) {
function sp_get_eos_keys( $raw ) {
$raw = str_replace( array( "\r\n", ' :' ), array( "\n", ':' ), $raw );
$arr = explode( "\r\n", $raw );
$arr = explode( "\n", $raw );
$output = array();
foreach ( $arr as $value ):
$output[] = substr( $value, 0, strpos( $value, ':') );
@@ -288,7 +299,7 @@ if ( !function_exists( 'sp_get_stats_row' ) ) {
case 'sp_team':
// Get stats settings columns
$columns = sp_get_eos_rows( $stats_settings['event'] );
$columns = sp_get_eos_rows( get_option( 'sp_event_stats_columns' ) );
// Setup variables
$results = array();
@@ -334,14 +345,14 @@ if ( !function_exists( 'sp_get_stats_row' ) ) {
$vars['against'] = 0; foreach( $posts as $post ): $result = $post->sp_result; unset( $result[ $post->sp_team_index ] ); $vars['against'] += array_sum( $result ); endforeach;
// Get EOS array
$rows = sp_get_eos_rows( $stats_settings['team'] );
$rows = sp_get_eos_rows( get_option( 'sp_team_stats_columns' ) );
break;
case 'sp_player':
// Get stats settings keys
$keys = sp_get_eos_keys( $stats_settings['player'] );
$keys = sp_get_eos_keys( get_option( 'sp_player_stats_columns' ) );
// Add object properties needed for retreiving event stats
foreach( $posts as $post ):
@@ -548,6 +559,16 @@ if ( !function_exists( 'sportspress_render_option_field' ) ) {
case 'checkbox':
echo '<input type="checkbox" id="' . $name . '" name="' . $group . '[' . $name . ']" value="1" ' . checked( 1, isset( $value ) ? $value : 0, false ) . '/>';
break;
case 'sport':
$terms = get_terms( 'sp_sport' );
if ( $terms ) {
printf( '<select id="%s" name="%s[%s]">', $name, $group, $name );
foreach ( $terms as $term ) {
printf( '<option value="%s" %s>%s</option>', $term->slug, selected( true, $value == $term->slug, false ), $term->name );
}
print( '</select>' );
}
break;
default:
echo '<input type="text" id="' . $name . '" name="' . $group . '[' . $name . ']" value="' . $value . '" />';
break;

View File

@@ -1,9 +1,10 @@
<?php
function sportspress_admin_menu() {
add_options_page(
add_submenu_page(
'edit.php?post_type=sp_event',
__( 'SportsPress Settings', 'sportspress' ),
__( 'SportsPress', 'sportspress' ),
__( 'Settings', 'sportspress' ),
'manage_options',
'sportspress',
'sportspress_settings'
@@ -73,6 +74,15 @@ function sportspress_intialize_stats() {
'sportspress_stats'
);
add_settings_field(
'sport',
__( 'Sport', 'sportspress' ),
'sportspress_sport_callback',
'sportspress_stats',
'sportspress_stats'
);
/*
add_settings_field(
'team',
__( 'Teams', 'sportspress' ),
@@ -96,6 +106,7 @@ function sportspress_intialize_stats() {
'sportspress_stats',
'sportspress_stats'
);
*/
register_setting(
'sportspress_stats',
@@ -105,6 +116,10 @@ function sportspress_intialize_stats() {
}
add_action( 'admin_init', 'sportspress_intialize_stats' );
function sportspress_sport_callback() {
sportspress_render_option_field( 'sportspress_stats', 'sport', 'sport' );
}
function sportspress_team_stats_callback() {
sportspress_render_option_field( 'sportspress_stats', 'team', 'textarea' );
}

View File

@@ -25,34 +25,48 @@ define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
include dirname( __FILE__ ) . '/lib/classes/eos.class.php' ;
// Globals
include dirname( __FILE__ ) . '/globals.php' ;
include dirname( __FILE__ ) . '/sportspress-globals.php' ;
// Helpers
require_once dirname( __FILE__ ) . '/helpers.php';
require_once dirname( __FILE__ ) . '/sportspress-helpers.php';
// Settings
include dirname( __FILE__ ) . '/settings.php' ;
include dirname( __FILE__ ) . '/sportspress-settings.php' ;
// Custom Post Types
require_once dirname( __FILE__ ) . '/team.php';
require_once dirname( __FILE__ ) . '/event.php';
require_once dirname( __FILE__ ) . '/player.php';
require_once dirname( __FILE__ ) . '/staff.php';
require_once dirname( __FILE__ ) . '/table.php';
require_once dirname( __FILE__ ) . '/list.php';
require_once dirname( __FILE__ ) . '/admin/post-types/event.php';
require_once dirname( __FILE__ ) . '/admin/post-types/team.php';
require_once dirname( __FILE__ ) . '/admin/post-types/stat.php';
require_once dirname( __FILE__ ) . '/admin/post-types/table.php';
require_once dirname( __FILE__ ) . '/admin/post-types/player.php';
require_once dirname( __FILE__ ) . '/admin/post-types/metric.php';
require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
// Taxonomies
require_once dirname( __FILE__ ) . '/division.php';
require_once dirname( __FILE__ ) . '/position.php';
// Terms
require_once dirname( __FILE__ ) . '/admin/terms/div.php';
require_once dirname( __FILE__ ) . '/admin/terms/pos.php';
require_once dirname( __FILE__ ) . '/admin/terms/sport.php';
// Styles
include_once dirname( __FILE__ ) . '/styles.php' ;
// Scripts
include_once dirname( __FILE__ ) . '/scripts.php' ;
// Shortcodes
// require_once dirname( __FILE__ ) . '/classes/shortcodes/table.php';
// Hooks, Actions, and Filters
require_once dirname( __FILE__ ) . '/hooks.php';
require_once dirname( __FILE__ ) . '/actions.php';
require_once dirname( __FILE__ ) . '/filters.php';
require_once dirname( __FILE__ ) . '/sportspress-hooks.php';
require_once dirname( __FILE__ ) . '/sportspress-actions.php';
require_once dirname( __FILE__ ) . '/sportspress-filters.php';
// Admin Styles
function sp_admin_styles() {
wp_register_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), '1.0' );
wp_enqueue_style( 'sportspress-admin');
}
add_action( 'admin_init', 'sp_admin_styles' );
// Admin Scripts
function sp_admin_enqueue_scripts() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'/assets/js/admin.js', array( 'jquery' ), time(), true );
}
add_action( 'admin_enqueue_scripts', 'sp_admin_enqueue_scripts' );
?>

View File

@@ -1,21 +0,0 @@
<?php
function sp_enqueue_styles() {
wp_register_style( 'stylesheet', get_bloginfo('stylesheet_url' ) );
wp_enqueue_style( 'stylesheet' );
wp_register_style( 'jquery-fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox-1.3.4.css' );
wp_enqueue_style( 'jquery-fancybox' );
}
//add_action( 'wp_print_styles', 'sp_enqueue_styles' );
function sp_admin_styles() {
wp_register_style( 'sportspress-admin.css', SPORTSPRESS_PLUGIN_URL . 'sportspress-admin.css', array(), '1.0' );
wp_enqueue_style( 'sportspress-admin.css');
}
add_action( 'admin_init', 'sp_admin_styles' );
function sp_adminbar_enqueue_styles() {
wp_register_style( 'adminbar-stylesheet', get_template_directory_uri() . '/css/adminbar.css' );
wp_enqueue_style( 'adminbar-stylesheet' );
}
//add_action( 'wp_head', 'sp_adminbar_enqueue_styles' );
?>