Skip to content

Instantly share code, notes, and snippets.

Avatar
I love programming...

Nabil Kadimi kadimi

I love programming...
View GitHub Profile
@kadimi
kadimi / sportspress-translate-read-more.php
Created Oct 5, 2022
SportsPress - Translate "Read more..."
View sportspress-translate-read-more.php
<?php
add_filter( 'gettext', function( $translated_text, $text, $domain ) {
if ( 'mega-slider' === $domain ) {
if ( 'Read more...' === $text ) {
return 'YOUR TEXT HERE';
}
}
return $translated_text;
}, 10, 3 );
@kadimi
kadimi / removeEndingSubString.js
Created Jun 26, 2022
Remove ending substring from a string
View removeEndingSubString.js
/**
* `removeEndingSubString` removes a substring from the end of a string.
*
* It will only remove the exact substring. So if the string doesn't end
* with the substring, nothing happens and the original string is returned
* as is.
*
* @link https://kadimi.com/ | https://gist.github.com/kadimi/32bb8f4cc56224343992806fd0898322
* @author Nabil Kadimi
*
@kadimi
kadimi / no-frontpage-sidebar.php
Last active Jun 3, 2022
Remove the sidebar from the front page only - Compatible with ThemeBoy themes.
View no-frontpage-sidebar.php
<?php
/**
* Remove the sidebar from the front page only - Compatible with ThemeBoy themes.
*
* @author Nabil Kadimi
*/
add_filter( 'option_themeboy', function( $value ) {
return is_front_page() ? [ 'sidebar' => 'no' ] + ( array ) $value : $value;
} );
@kadimi
kadimi / sporspress-cursomize-player-details.php
Created Apr 9, 2022
SportsPress - Customize Player Details
View sporspress-cursomize-player-details.php
<?php
add_filter( 'sportspress_player_details', function( $data ) {
$labels_from_to = [
'موضع' => 'المركز',
'الفريق الحالي' => 'النادي',
'المواسم' => 'الموسم الرياضي',
];
View playlist-dl.sh
youtube-dl -o '%(uploader)s - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'
@kadimi
kadimi / team_events_sorting_direction.php
Created Dec 20, 2021
SportsPress Team Event Sorting Direction
View team_events_sorting_direction.php
<?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 Sep 8, 2021
Disable comments on all attachments using WP-CLI - #wordpress #spam
View wp-disable-comment-on-all-attachments.sh
# /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.
View rei-landlist-carousel-autoplay-speed.php
@kadimi
kadimi / ninja-forms-allow-curly-brackets-in-notifications.php
Created May 2, 2021
Allow curly brackets in Ninja Forms notifications.
View ninja-forms-allow-curly-brackets-in-notifications.php
<?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 Oct 16, 2020
Custom slug for the SportsPress tab on a BuddyPress profile
View sp_bp_sportspress_tab_slug.php
<?php
/**
* Change this line.
*/
define( 'Custom_BP_SprotsPress_Tab_Slug', 'change-this' );
/**
* Do not change below this line.