Thanks for sharing! @Jay3 @condorito.fr
@edosantillana You can also try this snippet, it adds a shortcode which accepts the attribute name (e.g. [hivepress_listing_attribute name="attribute_name_here"]
) and displays the attribute value (note that it works within the listing page template only):
add_shortcode(
'hivepress_listing_attribute',
function( $atts ) {
if ( ! isset( $atts['name'] ) || ! is_singular( 'hp_listing' ) ) {
return;
}
$listing = \HivePress\Models\Listing::query()->get_by_id( get_the_ID() );
if ( ! $listing ) {
return;
}
return call_user_func( [ $listing, 'display_' . $atts['name'] ] );
}
);
Hope this helps