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_filter('the_content', function($content) { | |
if (is_singular('sp_tournament')) { | |
ob_start(); | |
?> | |
<div class='tournament_text_first'><?php echo $content; ?></div> | |
<style> | |
.entry-content { | |
display: flex; |
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_filter( 'sp_player_events_list_args', function( $args ) { | |
$args[ 'league' ] = get_option( 'sportspress_league', false ); | |
$args[ 'season' ] = get_option( 'sportspress_season', false ); | |
return $args; | |
} ); |
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_filter('posts_results', function($posts, $query) { | |
if (empty($_GET['feed']) || $_GET['feed'] !== 'sp-ical') { | |
return $posts; | |
} | |
foreach ($posts as &$post) { | |
$post->post_content = preg_replace("/\r?\n/", "\\n", $post->post_content); | |
} | |
return $posts; |
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 bulk action to re-assign SportsPress events titles. | |
*/ | |
add_filter('bulk_actions-edit-sp_event', fn ($actions) => $actions + ['sp_regenerate_title' => 'Regenerate Title']); | |
add_filter('handle_bulk_actions-edit-sp_event', function ($redirect_to, $action, $post_ids) { | |
if ($action !== 'sp_regenerate_title') { | |
return $redirect_to; |
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 | |
if (!empty($_GET['sportspress_debug'])) { | |
add_action('init', function () { | |
$all = []; | |
foreach ([ | |
'sp_outcome', | |
'sp_result', | |
'sp_performance', |
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 | |
/** | |
* Custom sorting function for timeline elements. | |
* | |
* | |
* ## The Problem | |
* | |
* When many timeline elements have the same minute(e.g, a goal and an assist | |
* both at 33'), they're thrown on the timeline in a random order are sorted. |
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 | |
function sp_get_event_tournaments($event_id) | |
{ | |
return get_posts([ | |
'post_type' => 'sp_tournament', | |
'posts_per_page' => -1, | |
'meta_query' => [ | |
[ | |
'key' => 'sp_event', |
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 | |
function sp_get_players_by_team($team, $current_or_past_or_all = 'all') | |
{ | |
switch ($current_or_past_or_all) { | |
case 'current': | |
$team_key = 'sp_current_team'; | |
break; | |
case 'past': | |
$team_key = 'sp_past_team'; |
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 a player list on the fly to the current team. | |
*/ | |
add_action( | |
'init', | |
function () { | |
/** |
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 | |
/** | |
* Customize past events list columns. | |
*/ | |
add_action( 'init', function() { | |
/** | |
* Desired columns. | |
* |
NewerOlder