Skip to content

Instantly share code, notes, and snippets.

View kadimi's full-sized avatar
I love programming...

Nabil Kadimi kadimi

I love programming...
View GitHub Profile
@kadimi
kadimi / sportspress-pro-direct-sponsor-link.php
Last active January 15, 2018 13:12
Override SportsPress Pro sponsor permalinks with actual sponsors links
@kadimi
kadimi / sportspress-show-performance-time-hours.php
Created March 12, 2018 14:08
Force `HH:MM:SS` format for prformance stats of type `time`
<?php
/**
* Force `HH:MM:SS` format for prformance stats of type `time`.
*/
add_filter( 'sportspress_event_performance_players', function( $data ) {
foreach ( $data as $i => &$stats ) {
foreach ( $stats as $key => &$value ) {
$perf = get_posts( array(
'name' => $key,
@kadimi
kadimi / wordpay-registration-require-names.php
Created April 13, 2018 17:07
Require first name and last name in WordPay registration.
<?php
/**
* Require first name and last name in WordPay registration.
*/
/**
* Add '*' after first name and last name labels.
*/
add_filter( 'wpay_register_form_label_first_name', function( $value ) { return "$value *"; } );
<?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
@kadimi
kadimi / sportspress-change-teams-abbreviations-into-short-names.php
Last active October 28, 2018 10:14
To use this code, add it to your theme "functions.php" file, access your dashboard with an adminstrator account, then remove the code from "functions.php".
<?php
/**
* Change teams abbreviations into short names.
*/
add_action( 'admin_init', function() {
/**
* Admin(s) only.
*/
<?php
/**
* The template for displaying archive pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Rookie
*/
get_header(); ?>
@kadimi
kadimi / sportspress-show-players-birthdate-in-dashboard.php
Last active May 31, 2018 04:35
Sportspress - Show Players Birthdate in Dashboard.php
<?php
add_filter( 'sportspress_player_admin_columns', function( $c ) {
return array_merge( $c + [ 'date' => 'Birth Date' ] );
} );
@kadimi
kadimi / sportspress-order-events-by-date-asc.php
Created June 21, 2018 08:47
Order SportsPress events by date in ascending order in the dashboard
<?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' ] ) ) {
@kadimi
kadimi / bp-sportspress-label.php
Created June 23, 2018 10:12
BuddyPress Label for SportsPress
<?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
@kadimi
kadimi / sportspress-fix-offense-defense-stats.php
Last active October 14, 2022 14:34
Fix SportsPress player stats (offense/defense)
<?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;