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 | |
/** | |
* Converts numbers in string from western to eastern Arabic numerals. | |
* | |
* @param string $str Arbitrary text | |
* @return string Text with western Arabic numerals converted into eastern Arabic numerals. | |
*/ | |
function arabic_w2e($str) { | |
$arabic_eastern = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'); |
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_team_events_list_args', function( $args ) { | |
$args[ 'order' ] = 'ASC'; | |
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
# /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. |
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 | |
/** | |
* Set the carousel autoplay speed to 7 seconds. | |
*/ | |
add_action( 'wp_footer', function () { | |
?><script> | |
jQuery( function ( $ ) { | |
$('.rei-land-carousel').slick( 'slickSetOption', 'autoplaySpeed', 7 * 1000 ); | |
} ); | |
</script><?php |
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 | |
/** | |
* 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) { |
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 | |
/** | |
* Change this line. | |
*/ | |
define( 'Custom_BP_SprotsPress_Tab_Slug', 'change-this' ); | |
/** | |
* Do not change below this line. |
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 | |
// 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' ); |
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
<? | |
/** | |
* 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' ] ); | |
} |
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 | |
/** | |
* Force showing venue without events. | |
*/ | |
add_action( 'loop_no_results', function( $q ) { | |
/** | |
* Only once. | |
*/ |
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 | |
/** | |
* Auto-create player lists in SportsPress. | |
* | |
* This code will generate player lists for teams without one. | |
* It's useful if your SportsPress site has a lot of teams and you don't | |
* want to create player lists one by one. | |
* | |
* The code will only work when the parameter `sp_create_player_lists` is |