This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* Do not show user results and user scores forms if the main result is set. | |
*/ | |
add_filter( 'sportspress_event_templates', function( $templates ) { | |
if ( sp_get_main_results( get_the_ID() ) ) { | |
unset( $templates[ 'user_results' ] ); | |
unset( $templates[ 'user_scores' ] ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Force showing venue without events. | |
*/ | |
add_action( 'loop_no_results', function( $q ) { | |
/** | |
* Only once. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Auto-create player lists in SportsPress. | |
* | |
* This code will generate player lists for teams without one. | |
* It's useful if your SportsPress site has a lot of teams and you don't | |
* want to create player lists one by one. | |
* | |
* The code will only work when the parameter `sp_create_player_lists` is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The main template file. | |
* | |
* This is the most generic template file in a WordPress theme | |
* and one of the two required files for a theme (the other being style.css). | |
* It is used to display a page when nothing more specific matches a query. | |
* E.g., it puts together the home page when no home.php file exists. | |
* Learn more: http://codex.wordpress.org/Template_Hierarchy | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying archive pages. | |
* | |
* Learn more: http://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package Rookie | |
*/ | |
get_header(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
youtube-dl -o '%(uploader)s - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add this code to your website, I recommend adding it using the plugin Code Snippets. | |
* Disable or delete the snippet as soon as you finish importing players. | |
* `$treshold_in_seconds` should be a little higher than the import duration in seconds. | |
* | |
* @author Nabil Kadimi | |
* @link https://themeboy.com | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get player performance for event. | |
* | |
* @param int $player_id Player ID. | |
* @param int $team_id Team ID. | |
* @param int $event_id Event ID. | |
* @return array|false Array of player performance or false | |
* if one of the parameters is not valid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this code to your custom template event-results.php, after $data has been filled | |
$orderBy = 'goals'; | |
$order = 'ASC'; // Or DESC | |
uasort( $data, function( $a, $b ) use ( $orderBy, $order ) { | |
return $order === 'DESC' | |
? $a[ $orderBy ] < $b [ $orderBy ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Example Usage. | |
*/ | |
sp_event_list_players_by_position( 'team-1', 'Team 1' ); | |
sp_event_list_players_by_position( 'team-2', 'Team 2' ); | |
sp_event_list_players_by_position( 'team-3', 'Team 3' ); | |
sp_event_list_players_by_position( 'team-4', 'Team 4' ); |