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

    (@gwin)

    Hi, it is possible to hide the Price field on the [adverts_add] by adding following code 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_price" ) {
            unset( $form["field"][$key] );
        }
      }
      return $form;
    }
    Thread Starter alpakal

    (@alpakal)

    Hi,

    Worked like a charm, cheers!

    One question about this though, I will change any classes related to “advert” to “wpadvert”, as per your suggestion on adblocker blocking the classifieds (has been discussed here

    Do I change the form name in the function above to “wpadvert” as well, or does it just change the classes associated with the plugin?

    Congratulations on a great and functional plugin by the way!

    Plugin Author Greg Winiarski

    (@gwin)

    The code above only checks if currently edited form is “advert”, this name is being used internally and it does not show on site anywhere, so you do not need to (and shouldn’t) change the form name.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hiding prices’ is closed to new replies.