This file contains hidden or 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 custom_posts_events( $query ){ | |
if( ! is_admin() && ! is_super_admin() ){ | |
if( is_archive() ){ | |
$grps = BP_Groups_Member::get_group_ids( get_current_user_id() ); | |
$marr['relation'] = 'OR'; | |
$marr[] = array( | |
'key' => 'eab_event-bp-group_event', |
This file contains hidden or 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 qtranslate_edit_taxonomies(){ | |
$args=array( | |
'public' => true , | |
'_builtin' => false | |
); | |
$output = 'object'; // or objects | |
$operator = 'and'; // 'and' or 'or' |
This file contains hidden or 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 | |
// RUN IT ONCE ONLY and USE as mu-plugin | |
/* | |
* To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. | |
* If there is no folder in that name, then create a folder, name it 'mu-plugins', | |
* create a file inside that, give any name you like and paste the code in there. | |
* You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. | |
* If you use mu-plugins then add a php start tag at the beginning of the code. |
This file contains hidden or 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( 'ms_model_membership_get_signup_membership_list', 'ms_model_membership_get_memberships_cb', 99, 3 ); | |
function ms_model_membership_get_memberships_cb( $memberships, $exclude_ids, $only_names ) { | |
// This is IMPORTANT. You have to put all child memberships ID in here in the order you want to show. | |
$new_order = array( 262, 266, 263 ); | |
$new_membership = array(); | |
foreach( $memberships as $membership ){ |
This file contains hidden or 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 | |
/* | |
* Use: [show_available_themes] or [show_available_themes col="3"] | |
*/ | |
function show_available_themes_cb( $atts ) { | |
$atts = shortcode_atts( array( | |
'col' => 4 | |
), $atts, 'show_available_themes' ); | |
$themes = wp_get_themes(); |
This file contains hidden or 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 | |
/* | |
* 1. Go to Settings > Permalinks and select any page as home page | |
* Then use the following code | |
* | |
* You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. | |
* Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. | |
* If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, | |
* give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, | |
* so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code. |
This file contains hidden or 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('init', 'change_display_name' ); | |
add_action( 'profile_update', 'change_display_name' ); | |
function change_display_name() { | |
$users = get_users(); | |
foreach( $users as $user ){ | |
if( $user->user_login != $user->display_name ){ | |
wp_update_user( array ('ID' => $user->ID, 'display_name'=> $user->user_login) ) ; | |
} |
This file contains hidden or 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( 'pre-upload-ui', 'get_the_post_type' ); | |
function get_the_post_type() { | |
$post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : 'post'; | |
set_transient( 'attached_post_type', $post_type ); | |
} | |
add_filter( 'intermediate_image_sizes_advanced', 'add_image_size_for_post_type', 10 ); | |
function add_image_size_for_post_type( $sizes ) { |
This file contains hidden or 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( 'ms_model_settings_get_currencies', 'membership_available_currencies_cb' ); | |
function membership_available_currencies_cb( $arr ){ | |
$arr['SYMBOL'] = 'SYMBOL - YOUR CURRENCY NAME'; | |
return $arr; | |
} |
This file contains hidden or 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( 'user_register', 'user_register_cb', 10, 1 ); | |
function user_register_cb( $user_id ){ | |
//You need to provide the course IDs in the following array | |
$courses = array( 102, 322, 424 ); | |
$student = new Student( $user_id ); | |
foreach( $courses as $course ){ | |
$student->enroll_in_course( $course ); | |
} |