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 custom sub-tab on groups page. | |
*/ | |
function buddypress_custom_group_tab() { | |
// Avoid fatal errors when plugin is not available. | |
if ( ! function_exists( 'bp_core_new_subnav_item' ) || | |
! function_exists( 'bp_is_single_item' ) || |
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 | |
// Enable WYSWING editor. | |
function bbp_enable_visual_editor( $r = array() ) { | |
$r['tinymce'] = true; | |
$r['media_buttons'] = true; | |
// Load WHYSWING. |
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 | |
/** | |
* We have to pass "is_new:0" and apply following filter. | |
*/ | |
function modify_where( $where_sql, $table_prefix, $r ) { | |
$where_sql = str_replace( 'AND is_new = 0', '', $where_sql ); |
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 | |
$url = 'https://bhargavb.com/'; | |
$qr_link = 'https://chart.googleapis.com/chart?chs=224x224&cht=qr&chl='. $url .'&choe=UTF-8'; | |
printf( '<img src="%s" alt="QR Code">', $qr_link ); |
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 | |
/** | |
* Get total number of weekdays in a year. | |
* | |
* @param string $day Week day. Sun, Mon, Tue,... | |
* @param string $year Year in 4 digits. | |
* @return integer Return total number of specified weekday for a year. | |
*/ | |
function get_total_weekday_in_year( $day = '', $year = '' ) { |
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 | |
function bb_bp_ps_before_search_form( $F ) { | |
$new = new stdClass(); | |
$new->display = 'selectbox'; | |
$new->code = 'age_from'; // to be removed | |
$new->html_name = 'age_from'; | |
$new->value = ''; |
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 | |
function test_callback_migration() { | |
if ( ! is_admin() && isset( $_GET['migrate_data'] ) ) { | |
if ( current_user_can( 'administrator' ) ) { | |
$page = filter_input( INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT ); |
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 selected url structure, selected in rtAmazon settings. | |
* | |
* @since 1.4.0 | |
* | |
* @param string $urls urls in content. | |
* | |
* @return array $newurls/$urls return array of all urls in content. | |
*/ |
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 custom sub-tab on user profile. | |
*/ | |
function buddyboss_custom_user_tab() { | |
// Avoid fatal errors when plugin is not available. | |
if ( ! function_exists( 'bp_core_new_nav_item' ) || | |
! function_exists( 'bp_loggedin_user_domain' ) || | |
empty( get_current_user_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
<?php | |
// Converts a number into a short version, eg: 1000 -> 1k | |
function thousandsCurrencyFormat( $num ) { | |
if ( $num > 999 ) { | |
$x = round( $num ); | |
$x_number_format = number_format( $x ); | |
$x_array = explode( ',', $x_number_format ); |
NewerOlder