Skip to content

Instantly share code, notes, and snippets.

View wbcomdev's full-sized avatar

Wbcom Dev wbcomdev

View GitHub Profile
@wbcomdev
wbcomdev / text-transform.php
Created October 23, 2023 10:53
text-transform-edd-sell
<?php
add_action('wp_head', 'wbcom_edd_test_tranform');
function wbcom_edd_test_tranform(){
?>
<style>
.edd-single-msg-wrapper .edd-msg {
text-transform: none!important;
}
</style>
<?php
@wbcomdev
wbcomdev / add-group-field.php
Created October 18, 2023 10:34
Add/Display ACF Field Group with Single Business
<?php
/**
* Get acf group fields
*
* @return void
*/
function get_acf_group_field() {
$acf_group_fields = acf_get_fields( 'group_652f89c399d0b' );// replace it with group key
return $acf_group_fields;
}
@wbcomdev
wbcomdev / allow-user-roles-to-stick-post.php
Last active September 15, 2023 05:30
Allows the user roles to stick the posts
<?php
**
* Wbcom Designs - Add user roles for sticky post
*
* @param array $user_roles user role.
* @return array
*/
function wbcom_add_roles_for_sticky_post( $user_roles ) {
$add_user_roles = array( 'subscriber' );
$user_roles = array_merge( $add_user_roles, $user_roles );
<?php
/**
* Wbcom Designs - Control access mode for instructor
*
* @param array $access_modes where define access.
*/
function wbcom_istructor_access_mode( $access_modes ) {
$access_modes = array(
'closed' => __( 'Closed', 'ld-dashboard' ),
);
<?php
/* Wbcom Designs - Use Gravatar */
add_filter('pre_get_avatar_data', function($args, $id_or_email){
unset($args['url']);
return $args;
},99,2);
/**
* Wbcom Designs - Hide Job Tab
*
<?php
* @return void
*/
function wbcom_hide_job_tab_no_posting() {
global $wpdb;
$user_id = get_current_user_id();
$job_query = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'job_listing' AND post_author = $user_id " );
<?php
/**
* Wbcom Designs - Hide resume tab
*
* @return void
*/
function wbcom_hide_resume_tab() {
$user_resume_data = get_user_meta( get_current_user_id(), 'bprm_resume_fields', true );
if ( empty( $user_resume_data ) ) {
?>
<?php
add_shortcode( 'bupr_shortcode_display_review_with_user_id', 'bupr_display_members' );
function bupr_display_members() {
global $wpdb , $bupr;
// give the user ids
$user_ids = array(24,2); // enter the comma saperated User ids
$bupr_type = 'integer';
$bupr_avg_rating = 0;
foreach( $user_ids as $user_id ){
$args = array(
<?php
/**
* Wbcom Designs - Show the fields of member in group
*/
$plugin_public = new Bp_Display_Xprofile_Public( 'bp-display-xprofile', '1.0.0' );
add_action( 'bp_group_members_list_item', array( $plugin_public, 'member_loop_modification_function' ), 999 );
?>
@wbcomdev
wbcomdev / suggestion-widget.php
Last active August 4, 2023 13:14
code snippet for remove specific user role from the suggestion widget
<?php
/**
* Wbcom Designs - Remove specific user role form suggestion list
*
* @param array $matched_members get users id.
*/
function bffs_remove_admin_role( $matched_members ) {
foreach ( $matched_members as $matched_member ) {
$user_data = get_userdata( $matched_member );
$restrict_role = array();