• Resolved jemigirl

    (@jemigirl)


    Hi Greg,

    Is it possible to make choosing a category required when a user posts an ad?

    Thanks,
    Julie

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

    (@gwin)

    Hi,
    yes it is possible, you can do that by adding the code below in your theme functions.php file

    
    add_filter( "adverts_form_load", "make_advert_category_required" );
    function make_advert_category_required( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "advert_category" ) {
            $form["field"][$key]["validator"][] = array( "name"=> "is_required" );
        }
      }
      return $form;
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Make category required?’ is closed to new replies.