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 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 | |
| /** | |
| * 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 | |
| /** | |
| * 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 | |
| /** | |
| * 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 | |
| /** | |
| * 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 | |
| /* | |
| * 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 | |
| /** | |
| * 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 | |
| /** | |
| * Woocommerce product count from product archive category page. | |
| * | |
| * @return void | |
| */ | |
| function wbcom_remove_product_result_count_from_category_page() { | |
| if ( is_product_category() ) { | |
| remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); | |
| } |
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 | |
| ** | |
| * Added to group automattic after succesfull user registration. | |
| * | |
| * @param string $user_id Get a user id. | |
| */ | |
| function wbcom_add_user_to_group_after_registration( $user_id ) { | |
| if ( ! function_exists( 'groups_join_group' ) ) { | |
| return; | |
| } |