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. | |
*/ | |
add_action( 'sportspress_after_event_template', function( $elements ) { | |
$elements['performance']['action'] = function() { | |
sp_event_players_2d_positions( | |
[ 'team-1', 'team-2', 'team-3', 'team-4' ], | |
[ 'lead', 'second', 'third', 'skipper' ], |
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 | |
/** | |
* WooCommere Bookings - Check if current page is a bookable product. | |
* @return boolean True for bookable products, false otherwise | |
*/ | |
function is_bookable_product() { | |
return is_product() && wc_get_product() instanceof WC_Product_Booking; | |
} |
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 | |
/** | |
* WooCommerce Bookings - Get Bookings for Product. | |
* @param int $product_id Product ID. | |
* @return array Bookings IDs. | |
*/ | |
function wc_bookings_get_booking_ids_by_product_id( $product_id ) { | |
return WC_Booking_Data_Store::get_booking_ids_by( [ | |
'object_id' => $product_id, |
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
#!/bin/sh | |
## Cleanup | |
rm -f palette.png video.gif | |
## Make palette | |
# --ss stop at seconds | |
# --t duration | |
ffmpeg -ss 10 -t 4 -i video.mp4 -vf fps=15,scale=800:-1:flags=lanczos,palettegen palette.png |
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
jQuery('.s-item__seller-info-text') | |
.filter(function() { | |
let s = $(this).text(); | |
let re = /\((.*)\) (.*)%/g; | |
do { | |
m = re.exec(s); | |
if (m) { | |
feedback_score = parseInt(m[1].replace(',', '')); | |
positive_feedback = parseFloat(m[2]); |
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( 'sportspress_player_data_event_args', function( $args ) { | |
foreach ( $args[ 'meta_query' ] as &$m ) { | |
if ( true | |
&& is_array( $m ) | |
&& array_key_exists( 'key', $m ) | |
&& in_array($m[ 'key' ], [ 'sp_offense', 'sp_defense' ] ) | |
) { | |
$m = null; |
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 | |
/* | |
Plugin Name: BuddyPress Label for SportsPress | |
Plugin URI: https://www.themeboy.com/sportspress-extensions/buddypress/ | |
Description: Plugin allows changing the label of SportPress within BuddyPress pages, go to "SportsPress > Settings > Text" then scroll down to the latest option "SportsPress (BuddyPress)" and fill it with your choice. | |
Author: Nabil Kadimi - Support Engineer at ThemeBoy | |
Version: 1.0.0 | |
License: GNU General Public License v3.0 | |
License URI: http://www.gnu.org/licenses/gpl-3.0.html |
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 | |
/** | |
* Order SportsPress events by date in ascending order in the dashboard. | |
*/ | |
add_action( 'admin_init', function() { | |
if ( empty( $_GET[ 'post_type' ] || 'sp_event' !== $_GET[ 'post_type' ] ) ) { | |
return; | |
} | |
if ( ! empty( $_GET[ '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 | |
add_filter( 'sportspress_player_admin_columns', function( $c ) { | |
return array_merge( $c + [ 'date' => 'Birth Date' ] ); | |
} ); |
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(); ?> |