Title: Custom fields
Last modified: August 30, 2016

---

# Custom fields

 *  Resolved [lborges1981](https://wordpress.org/support/users/lborges1981/)
 * (@lborges1981)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/)
 * 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!
 * [https://wordpress.org/plugins/wpadverts/](https://wordpress.org/plugins/wpadverts/)

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [Sebastien SERRE](https://wordpress.org/support/users/sebastienserre/)
 * (@sebastienserre)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681089)
 * Hello,
 * It seems possible: [http://wpadverts.com/documentation/custom-fields/](http://wpadverts.com/documentation/custom-fields/)
   
   i’m currently trying to add ACF field…and lots of error!!
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681117)
 * The recommended way do this is described here [http://wpadverts.com/documentation/custom-fields/](http://wpadverts.com/documentation/custom-fields/)(
   it requires some PHP programming knowledge).
 * The ACF plugin will not allow you to do that i suppose.
 *  [Sebastien SERRE](https://wordpress.org/support/users/sebastienserre/)
 * (@sebastienserre)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681127)
 * ACF is creating my custom fields so I don’t understand I can’t link them in the
   shortcode [adverts_add] …
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681130)
 * 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.
 *  [Sebastien SERRE](https://wordpress.org/support/users/sebastienserre/)
 * (@sebastienserre)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681132)
 * Which API do you use?
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681166)
 * See [http://wpadverts.com/documentation/custom-fields/](http://wpadverts.com/documentation/custom-fields/)
   maybe it’s not as much as API, but rather data used to generate form.
 *  [Sebastien SERRE](https://wordpress.org/support/users/sebastienserre/)
 * (@sebastienserre)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681218)
 * 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.
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681254)
 * 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.
 *  [Hartamon](https://wordpress.org/support/users/hartamon/)
 * (@hartamon)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681322)
 * Hi!
 * Thanks for great plugin!
 * Is there a way to show different custom fields for different categories&
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681332)
 * Hi,
    i am afraid not mainly because the code which customizes the form structure
   is executed before category is selected.
 *  Thread Starter [lborges1981](https://wordpress.org/support/users/lborges1981/)
 * (@lborges1981)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681334)
 * 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!
 *  [Sebastien SERRE](https://wordpress.org/support/users/sebastienserre/)
 * (@sebastienserre)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-6681335)
 * if you have php acknowledgement, you can include a in a mu-plugins or in your
   theme’s functions.php
 *  [Jukka Mykkänen](https://wordpress.org/support/users/karusellimedia/)
 * (@karusellimedia)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-8195823)
 * 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?
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-8200978)
 * 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.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Custom fields’ is closed to new replies.

 * ![](https://ps.w.org/wpadverts/assets/icon-256x256.png?rev=2423472)
 * [WPAdverts - Classifieds Plugin](https://wordpress.org/plugins/wpadverts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpadverts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpadverts/)
 * [Active Topics](https://wordpress.org/support/plugin/wpadverts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpadverts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpadverts/reviews/)

## Tags

 * [custom form fields](https://wordpress.org/support/topic-tag/custom-form-fields/)

 * 14 replies
 * 5 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/custom-fields-183/#post-8200978)
 * Status: resolved