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;
}
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!
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.