Hi,
I tried a lot of things but I cant solve my problem.
I want to simply add a new element (for example a text label) in booking view page like this:
I tried this code but is not woking:
add_filter(
'hivepress/v1/templates/booking_view_page',
function ($args) {
return hivepress()->helper->merge_trees(
$args,
[
'blocks' => [
'page_content' => [
'blocks' => [
'booking_details_primary' => [
'blocks' => [
'new_element' => [
'label' => 'test label',
'type' => 'text',
'attributes' => [
'id' => 'booking_details_primary',
],
],
],
],
],
]
],
],
);
},
1000
);
Thanks in advance!
Emilio
andrii
November 1, 2023, 7:23am
2
Hi,
You can use booking attributes, please check this doc How to add booking attributes - HivePress Help Center
Hi andri,
I need to make a custom element via code, also if I create a attribute I’m not able to access it via hook.
Thanks in advance.
Emilio.
yevhen
November 3, 2023, 1:23pm
6
Please try this PHP code snippet
add_filter(
'hivepress/v1/templates/booking_view_page',
function ($args) {
return hivepress()->template->merge_blocks(
$args,
[
'page_content' => [
'blocks' => [
'booking_details_primary' => [
'blocks' => [
'new_element' => [
'label' => 'test label',
'type' => 'content',
'content' => '<div>Custom text</div>',
'attributes' => [
'id' => 'booking_details_primary',
],
],
],
],
],
]
]
);
},
1000
);
1 Like
system
Closed
December 3, 2023, 1:23pm
7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
antbes
January 24, 2025, 2:23pm
8
I want to display informations about users on list of bookings,and on booking display, like this
How can i do this ? hook ? templates don’t work for bookings ?
andrii
January 27, 2025, 10:11am
10
Hi,
Please check the solution in this topic. Also, please note that it can require further customization.
Ollie
February 13, 2025, 9:18pm
11
Good evening Andrii,
Please could you reveal the snippet for that particular request?
Regarding:
User name, email, phone number
Is this to be entered into the child theme?
Many thanks in advance
andrii
February 14, 2025, 1:06pm
13
Hi,
Please clarify, do you need to display the user’s username, email and phone number in the booking block and in the booking page for the vendor in its dashboard? If so, we can provide general guidance if you are familiar with coding or have a developer. Please let me know if this will work for you.
Ollie
February 14, 2025, 2:20pm
14
Hiya, yes spot on, what you have stated is correct.
Thank you!
ihor
February 18, 2025, 10:02pm
16
Sorry for the delay.
The easiest way is to override one of the existing template parts, for example via a child theme. For example, you can override this template part:
hivepress-bookings/templates/booking/view/booking-status.php
Inside you can add custom HTML or PHP code. It’s possible to get the booking user this way:
$user=$booking->get_user();
echo $user->get_email();
echo $user->get_phone();
echo $user->get_username();
Hope this helps
1 Like