propertyhive / WP-Property-Hive

The complete estate agency software plugin for WordPress
Other
27 stars 27 forks source link

Property meta re-structure #88

Closed CHEWX closed 5 years ago

CHEWX commented 5 years ago

Hi,

https://github.com/propertyhive/WP-Property-Hive/blob/3b974410f01dca22af4589b0f6a08b0ac7fe08ee/templates/single-property/meta.php#L22-L68

I think this needs restructuring.

It's too explicit on output and there is no way to filter/edit other than overriding the template and copy pasting the whole template to just edit a few text fields. I would say a template should only be overridden if markup changes or significant development is required, not something as small as appending/removing labels.

Not done a PR as there are a few approaches so just thought I'd raise this to see if anyone agrees.

Thanks, Tom

propertyhive commented 5 years ago

Totally agree. I'm actually releasing a new version of Hive (1.4.38) in a bit so have managed to squeeze a change in regarding this which you can see here:

https://github.com/propertyhive/WP-Property-Hive/commit/4753418b5d13011b744e379fea2b3de2c055f568

Everything is now done outside of the template and you can use a filter propertyhive_single_property_meta to adjust the data passed to the template like so:

add_filter( 'propertyhive_single_property_meta', 'custom_meta' );
function custom_meta( $meta )
{
    unset($meta['bedrooms']); // Removing bedrooms from meta as an example
    return $meta;
}

Should be released in the next few hours.

Steve