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 | |
// need to pass $the_query | |
function batd_num_pagination($the_query){ | |
$total_pages = $the_query->max_num_pages; | |
if ($total_pages > 1) { | |
$paged = batd_paged_query_var(); | |
$current_page = max(1, $paged); | |
echo '<div class="pagination no-ajax batd-pag" id="pag-top">'; |
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_action( 'wp_head', 'record_user_last_activity' ); | |
function record_user_last_activity(){ | |
$get_users = get_users( array( 'fields' => array( 'ID' ) ) ); | |
if(!empty($get_users)){ | |
foreach($get_users as $single){ | |
bp_update_user_last_activity($single->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 | |
function get_group_ids_by_type($type){ | |
$group_ids = array(); | |
$meta_query = array( | |
array( | |
'key' => 'group_type', | |
'value' => $type, | |
'compare' => '=' | |
) | |
); |
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_action( 'wp', array($this, 'change_existing_user_forum_role') ); | |
function change_existing_user_forum_role(){ | |
$args = array ( | |
'role' => 'bbp_spectator', | |
); | |
$user_query = new WP_User_Query( $args ); | |
if ( ! empty( $user_query->results ) ) { |
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 time_elapsed($secs){ | |
$bit = array( | |
'y' => $secs / 31556926 % 12, | |
'w' => $secs / 604800 % 52, | |
'd' => $secs / 86400 % 7, | |
'h' => $secs / 3600 % 24, | |
'm' => $secs / 60 % 60, | |
's' => $secs % 60 | |
); |
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
To do this, need to write this line in .htaccess file - | |
RewriteRule ^(sites/default/files/.*) http://livesite.com/$1 [L] |
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 advanced_search_query1($query) { | |
if ($query->is_search()) { | |
$query->set('post_type', array('product')); | |
return $query; | |
} | |
} | |
add_action('pre_get_posts', 'advanced_search_query1', 1000); |