I am looking to show “Booking Available From” attribute and “Booking Available To” attribute on the Page Secondary like in the screenshot below. How can we do this?
Thanks,
Tom
I am looking to show “Booking Available From” attribute and “Booking Available To” attribute on the Page Secondary like in the screenshot below. How can we do this?
Thanks,
Tom
Please try this PHP snippet
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset($attributes['booking_min_time']) ) {
$attributes['booking_min_time']['display_areas'] = ['view_page_secondary'];
}
if ( isset($attributes['booking_max_time']) ) {
$attributes['booking_max_time']['display_areas'] = ['view_page_secondary'];
}
return $attributes;
},
1000
);
Well that worked to show the times:
But how do I get the text and icons like in the screenshot I provided in the main topic?
Thanks,
Tom
Please try this snippet instead and change the display format if required:
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset($attributes['booking_min_time']) ) {
$attributes['booking_min_time']['icon']='clock';
$attributes['booking_min_time']['display_areas'] = ['view_page_secondary'];
$attributes['booking_min_time']['display_format'] = '%icon% %label%: %value%';
}
if ( isset($attributes['booking_max_time']) ) {
$attributes['booking_max_time']['icon']='clock';
$attributes['booking_max_time']['display_areas'] = ['view_page_secondary'];
$attributes['booking_max_time']['display_format'] = '%icon% %label%: %value%';
}
return $attributes;
},
1000
);
Ok, this is getting us very close! Are you sure Icon is represented this way?
$attributes['booking_min_time']['icon']='arrow-circle-right';
It shows up like this no matter what icon I use:
Thanks,
Tom
Please try this PHP snippet instead
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
error_log(print_r($attributes['type'], true));
if ( isset($attributes['booking_min_time']) ) {
$attributes['booking_min_time']['display_areas'] = ['view_page_secondary'];
$attributes['booking_min_time']['display_format'] = '<i class="hp-icon fas fa-fw fa-clock"></i> %label%: %value%';
}
if ( isset($attributes['booking_max_time']) ) {
$attributes['booking_max_time']['display_areas'] = ['view_page_secondary'];
$attributes['booking_max_time']['display_format'] = '<i class="hp-icon fas fa-fw fa-clock"></i> %label%: %value%';
}
return $attributes;
},
1000
);
That does the trick! Thanks Yevhen!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.