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 / sporspress-cursomize-player-details.php
Created April 9, 2022 15:57
SportsPress - Customize Player Details
<?php
add_filter( 'sportspress_player_details', function( $data ) {
$labels_from_to = [
'موضع' => 'المركز',
'الفريق الحالي' => 'النادي',
'المواسم' => 'الموسم الرياضي',
];
@kadimi
kadimi / playlist-dl.sh
Created February 12, 2022 16:48
playlist-dl
youtube-dl -o '%(uploader)s - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'
@kadimi
kadimi / team_events_sorting_direction.php
Created December 20, 2021 12:31
SportsPress Team Event Sorting Direction
<?php
add_filter( 'sp_team_events_list_args', function( $args ) {
$args[ 'order' ] = 'ASC';
return $args;
} );
@kadimi
kadimi / wp-disable-comment-on-all-attachments.sh
Last active September 8, 2021 21:31
Disable comments on all attachments using WP-CLI - #wordpress #spam
# /bin/sh
# Disable comments on all attachment posts using WP-CLI - #wordpress #spam
wp post update --comment_status=closed $(wp post list --post_type=attachment --format=ids)
#
# Sample Output
# =============
# Success: Updated post 3.
@kadimi
kadimi / ninja-forms-allow-curly-brackets-in-notifications.php
Created May 2, 2021 04:35
Allow curly brackets in Ninja Forms notifications.
<?php
/**
* Allow text between brackets in Ninja Forms notifications.
*
* - How to Use: wrap the text you want to put inside curly brackets in double square brackets, e.g. `[[tag]]`.
* - Setup: Add this code to your website (I recommend using the plugin Code Snippets).
*
* @author Nabil @ REI Conversion
*/
add_filter( 'ninja_forms_action_email_message', function($message) {
@kadimi
kadimi / sp_bp_sportspress_tab_slug.php
Last active October 16, 2020 16:29
Custom slug for the SportsPress tab on a BuddyPress profile
<?php
/**
* Change this line.
*/
define( 'Custom_BP_SprotsPress_Tab_Slug', 'change-this' );
/**
* Do not change below this line.
@kadimi
kadimi / sort_players_by_title_in_event_editing_pages.php
Created July 19, 2020 20:13
SportsPress - Sort players by title in event editing pages
<?php
// SportsPress - Sort players by title in event editing pages
add_action( 'admin_init', function() {
add_filter( 'pre_get_posts', function( $query ) {
if(
get_current_screen()->parent_file === 'edit.php?post_type=sp_player'
&& $query->get( 'post_type' ) === 'sp_player'
) {
$query->set( 'orderby', 'title' );
@kadimi
kadimi / sp_hide_event_forms.php
Created February 25, 2020 17:43
Do not show user results and user scores forms if the main result is set
<?
/**
* 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' ] );
}
@kadimi
kadimi / showing-venue-without-events.php
Last active January 29, 2020 21:04
Force showing venue without events
<?php
/**
* Force showing venue without events.
*/
add_action( 'loop_no_results', function( $q ) {
/**
* Only once.
*/