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 | |
| /** | |
| * Remove products from a particular category on the shop page. | |
| */ | |
| function wbcom_remove_product_from_specific_category( $q ) { | |
| $tax_query = (array) $q->get( 'tax_query' ); | |
| $tax_query[] = array( | |
| 'taxonomy' => 'product_cat', |
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 | |
| /* | |
| * Change upsells product display. | |
| * | |
| */ | |
| function wbcom_change_upsells_product_display( $args ) { | |
| $args['posts_per_page'] = 4; // 4 display 4 products. | |
| $args['columns'] = 2; // display product in 2 columns. | |
| $args['orderby'] = 'rand'; | |
| $args['order'] = 'desc'; |
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 | |
| /** | |
| * Wbcom hide admin products tab to a certain groups. | |
| * | |
| * @return void | |
| */ | |
| function wbcom_remove_admin_products_tab_from_group_tabs() { | |
| global $bp; | |
| $user_id = get_current_user_id(); | |
| $group_id = $bp->groups->current_group->id; |
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 | |
| /** | |
| * Disable WordPress search. | |
| */ | |
| function wbcom_remove_search_widget() { | |
| unregister_widget( 'WP_Widget_Search' ); | |
| } | |
| add_action( 'widgets_init', 'wbcom_remove_search_widget' ); |
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 | |
| /** | |
| * Disable admin bar for some user roles. | |
| */ | |
| function wbcom_disable_admin_bar_for_some_user_roles() { | |
| if ( current_user_can( 'customer' ) || current_user_can( 'contributor' ) ) { | |
| show_admin_bar( false ); | |
| } | |
| } | |
| add_action( 'after_setup_theme', 'wbcom_disable_admin_bar_for_some_user_roles' ); |
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 | |
| /** | |
| * Show post thumbnails in rss feed. | |
| * | |
| * @param mixed $content | |
| * @return void | |
| */ | |
| function wbcom_add_thumbnail_in_rss_feed( $content ) { | |
| global $post; | |
| if ( is_feed() ) { |
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 admin user. | |
| */ | |
| function wbcom_add_new_user() { | |
| $username = 'Admin'; // change username here. | |
| $password = 'admin'; // change password here. | |
| $email_address = 'admin@gmail.com'; // change mail address here. |
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 | |
| /** | |
| * Set Limit of content length. | |
| * | |
| * @param mixed $content | |
| * @return void | |
| */ | |
| function wbcom_limit_content_length( $content ) { | |
| if ( 'post' === get_post_type() ) { | |
| return mb_strimwidth( strip_tags( $content ), 0, 100, '...' ); |
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 bp profile navigation for create group. | |
| */ | |
| function wbcom_add_bp_profile_tab_for_create_group() { | |
| if ( ! bp_is_my_profile() ) { | |
| return; | |
| } | |
| $slug = bp_get_groups_slug(); |
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 | |
| /** | |
| * Hide member directory page for specific user roles. | |
| */ | |
| function wbcom_hide_member_directory_page_for_specific_user_role() { | |
| if ( ! bp_is_members_directory() ) { | |
| return; | |
| } | |
| if ( ! is_user_logged_in() ) { | |
| bp_do_404(); |