add_filter('frm_setup_new_fields_vars', 'frm_populate_posts', 20, 2);The issue is that it's being appended to the .form-wrapper div instead of the HTML field div (Field ID=21). I've attached screenshots for your reference. Any help would be greatly appreciated. Thanks
add_filter('frm_setup_edit_fields_vars', 'frm_populate_posts', 20, 2); //use this function on edit too
function frm_populate_posts($values, $field){
if($field->id == 8){ //replace 125 with the ID of the field to populate
$posts = get_posts( array('post_type' => 'volumes', 'post_status' => array('publish', 'private'), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC'));
foreach($posts as $p){
echo '
' . $p->post_title . '
';
}
}
return $values;
}
According to your screen print, $field->id == 8 is executing on the section header, not the HTML field, which should be $field->id == 21. Change your code as suggested, and let us know what changes. All Formidable fields can be used with the two hooks you are using. When nesting fields, always address the field directly in your code and the field wrapper.
Please login or Register to submit your answer