Update Wordpress function for custom Gravity Forms field population
$8-15 USD / orë
At the moment t we have a Gravity Form where a dropdown is dynamically populated with the values in a User Profile custom field - in this case the Coach’s expert area.
We have now changed the way we organize the expert areas and they are now a proper taxonomy ‘Expertise’ in the User type.
Task:
I’d like the code to look at the taxonomy ‘Expertise’ and list all the terms that are being used at least once in the dropdown.
Each term should be listed only once, even if used by multiple coaches.
The dropdown list should be sorted alphabetically.
Existing Code:
function populate_coaches( $form ) {
if ( $form['title'] != "Coaching" ) return $form;
foreach ( $form['fields'] as &$field ) {
if ( $field->type != 'select' || strpos( $field->cssClass, 'coaches-dropdown' ) === false ) {
continue;
}
// Instruction: Change this to look for all terms in user taxonomy Expertise instead
$args = array (
'role' => 'coach',
'meta_key' => 'expertise',
'orderby' => 'meta_key',
'order' => 'ASC'
);
// Create the WP_User_Query object
$wp_user_query = new WP_User_Query($args);
// Get the results
$coaches = $wp_user_query->get_results();
//$choices = array(array('text' => 'Please choose:', 'value' => 0 ));
$i = 1;
foreach( $coaches as $coach ) {
// Load the userinfo
$coach_info = get_userdata($coach->ID);
$coachname = $coach->display_name;
$coachexpertise = $coach->expertise;
$choices[] = array( 'text' => $coachexpertise, 'value' => $i++, 'isSelected' => false );
}
$field['choices'] = $choices;
}
return $form;
}
I'd be expecting this to take no more then 15 minutes or so. FTP access can be arranged.
ID Projekti: #17607357
Rreth projektit
31 profesionistë freelancer dërguan një ofertë mesatare prej $13/orë për këtë punë
Hello, I will integrate the specified functions into your website. I will update your website as per your requirements and expectations. I would like to have a discussion for further details. Can we discuss over Më shumë
Hello, I have been engaged in website development and design. I hope my work, reviews & rating will comfort you to to discuss this project with me. I analyze your requirements those you mention in your project descript Më shumë
Hello sir, i am interested in your project ready to start work as per your requirement waiting for your response Thanks
HI, As per your job description, I am the senior developer I am skilled in both the front end and back end technologies. I am having 6+ years experience in this field so I can assure you to provide you quality work Më shumë
Hello, I have read your requirement and i am interested in your job. I have 5+ year experience of Wordpress and PHP. I can start work now. I know you will get lots of low ball bids. Waiting for your positive reply Më shumë
Hello sir, I am Wordpress expert with 6 years experience. completed over 100 projects. I have understood the requirements. I can complete your work within time with quality and big smile promise. I believe in Më shumë