• @greg Winiarski You are doing an excellent job. Very easy and nice plugin.
    I am running this plugin on my website. It works great. But I have a question. As we can see name, description and email etc fields are required while posting an ad. What if I want to bound ad poster to fill location filed and location field will be required to post an ad. ref: https://www.petshill.com/adverts/add/ You can see location field on my page. It is not showing any required sign just like name and description.

    Please can you guide me what to do. As I am not a professional with PHP. I know very little about codes.

    Thanks in Advance.
    Muhammad Usman Afzal

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

    (@gwin)

    Hi, sorry i missed your question, as i usually do not read the reviews (but i am very thankful you wrote one, thanks!).

    As for your question in order to make the location field required you will need to add following code in your theme functions.php file

    add_filter( "adverts_form_load", "customize_adverts_add" );
    function customize_adverts_add( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "adverts_location" ) {
            $form["field"][$key]["is_required"] = true;
            $form["field"][$key]["validator"] = array(
                array( "name" => "is_required" ),
            );
        }
      }
      return $form;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Excellent Plusing But I have a Question?’ is closed to new replies.