• Resolved jlco2000

    (@jlco2000)


    Como puedo modificar el formulario [adverts_add] en especial el campo “Location” quisiera poner una lista de ciudades. gracias

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    the easiest way to modify the fields in [adverts_add] is to use the drag and drop form editor in the Custom Fields extension.

    If you are familiar with PHP programming you can also modify the form via adverts_form_load filter https://wpadverts.com/documentation/custom-fields/

    For example to make the Location in [adverts_list] a dropdown you can paste the code below in your theme functions.php file

    
    add_filter( "adverts_form_load", function( $form ) {
        if( $form["name"] == "advert" ) {
            return $form;
        }
    
        foreach( $form["field"] as $k => $field ) {
            if( $field["name"] == "adverts_location" ) {
                $form["field"][$k]["type"] = "adverts_field_select";
                $form["field"][$k]["options"] = array(
                    array("value"=>"One", "text"=>"One"),
                    array("value"=>"Two", "text"=>"Two"),
                );
            }
        }   
    
        return $form;
    } );
    

    Just replace the “One” and “Two” options with actual options you would like to use (and of course add an additional options).

    P.S. It would be great if you could write your questions in English, thanks.

    Thread Starter jlco2000

    (@jlco2000)

    muchas gracias

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

The topic ‘Publicar anuncios’ is closed to new replies.