Custom fields
-
Hi!
Excellent plugin, congratulations!I was wondering if would be possible to insert some additional fields in the form to add an advertising and use them as filters as well.
Thanks a lot!
-
Hello,
It seems possible: http://wpadverts.com/documentation/custom-fields/
i’m currently trying to add ACF field…and lots of error!!The recommended way do this is described here http://wpadverts.com/documentation/custom-fields/ (it requires some PHP programming knowledge).
The ACF plugin will not allow you to do that i suppose.
ACF is creating my custom fields so I don’t understand I can’t link them in the shortcode [adverts_add] …
Because WPAdverts and ACF are using different “APIs” to manage meta fields, so [adverts_add] is not aware of ACF fields and vice versa, Custom Fields created as in WPAdverts documentation will not be visible in ACF.
Which API do you use?
See http://wpadverts.com/documentation/custom-fields/ maybe it’s not as much as API, but rather data used to generate form.
Hello,
I’ve some trouble to understand how to add custom field.
I’d like to add a required fields with an integer.
This code runs only for “is_required but not for “is_integer”$form["field"][] = array( "name" => "advert_bed", "type" => "adverts_field_text", "order" => 20, "label" => 'couchage', "max_choices" => 1, "options" => array(), "is_required" => true, "validator" => array( array( "name"=> "is_required", ), array( "name" => "is_integer" ), ), );Could you quickly explain how your code is running (I tihink you should discover ACF, it will give your plugin and there users more ease to create custom field.
Hi,
1. i do know about ACF plugin it is amazing, but i do not really think it is suitable for integration with WPAdverts as it is made only to have custom fields in wp-admin panel not in the frontend.2. if the value for the field is not provided then only is_required validator will be run, if there is value in the form all validators will be executed however i found there is a bug in is_integer, it will validate number properly but if the provided text is string (“abcd”) it will always pass validation i will fix this in next release.
Other than that your code seems fine.
Hi!
Thanks for great plugin!
Is there a way to show different custom fields for different categories&
Hi,
i am afraid not mainly because the code which customizes the form structure is executed before category is selected.Sorry by being so newbie, but wich file(s) I am supposed to edit in order to have custom fields in the form and the listing? Tried to follow the documentation but wasn’t able to find the correct file.
Thanks a lot!if you have php acknowledgement, you can include a in a mu-plugins or in your theme’s functions.php
Hi,
I have a little problem with positioning the custom fields. I’d like to put new fields right after category. But, if I set Order to 20 the custom fields go to the end of the form and if I set it to 19 the custom fields go right after users contact info. Any ideas?
Hi, right now all the fields have order either 10 or 20, to put a field exactly after selected field, you will need to first reset fields order
add_filter("adverts_form_load", "reset_fields_order", 5); function reset_fields_order( $form ) { if( $form["name"] != "advert" ) { return $form; } $i = 0; foreach( $form["field"] as $k => $field ) { $form["field"][$k]["order"] = $i*5; $i++; } return $form; }After adding this code each field should have its own unique order number and you should be able to place a field exactly where you would like to have it.
The topic ‘Custom fields’ is closed to new replies.