I have two questions.
I am trying to find a solution to let the user select how the image is cropped. Is there a solution for this, I have been trying to use Croppie, but can’t figure out how to get it to work in the listing_submit form. I can understand how to add filters to add and modify fields. But ideally it would trigger when when the user tried to upload the image. This implementation is a little complex for me. Any guidance to get me started would be appreciated. I would also be happy to make my own template for the user listing form, and implement it that way, is there any documentation on how to do that?
I want to make it so the user can select categories with a checkbox so multiple categories can be selected in listing_submit . I tried like this but it didn’t work
add_filter(
'hivepress/v1/forms/listing_submit',
function( $form ) {
// Check if the Categories field exists in the form
if ( isset( $form['fields']['categories'] ) ) {
// Change the field type to 'checkboxes'
$form['fields']['categories']['type'] = 'checkboxes';
$categories = get_terms( array(
'taxonomy' => 'hp_listing_category',
'hide_empty' => false,
) );
if ( ! is_wp_error( $categories ) ) {
$options = [];
foreach ( $categories as $category ) {
$options[ $category->term_id ] = $category->name;
}
$form['fields']['categories']['options'] = $options;
}
}
return $form;
}
);