• Resolved jotomas

    (@jotomas)


    Hi,

    My WP Adverts site is based in a single location and, therefore, the Location field does not make much sense.

    Is it possible to hide it everywhere (Add Ad Form, Search, etc.)?

    I look forward to your reply.

    Thank you very much for your help.

    Best regards.

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

    (@gwin)

    Hi, you can remove Location field from [adverts_add] and [adverts_list] by adding the code below to 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" ) {
            unset( $form["field"][$key] );
        }
      }
      return $form;
    }
    
    add_filter( "adverts_form_load", "customize_adverts_list" );
    function customize_adverts_list( $form ) {
      if( $form['name'] != "search" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "query" ) {
            $form["field"][$key]["meta"]["search_type"] = "full";
        }
        if( $field["name"] == "location" ) {
            unset( $form["field"][$key] );
        }
      }
      return $form;
    }
    
    Thread Starter jotomas

    (@jotomas)

    Hi Greg,

    Great! Thanks a lot!

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide Location’ is closed to new replies.