Option to set custom H1 for listings

Hi Hivepress community,

I am looking for a way to manually edit listing H1. I am currently using tokens and it is auto completing the H1 of the listings but those contain some information I do not want. When using tokens, H1 are not editable and when not using it, H1 and title becomes editable by the user, which I don’t want either.

Is there a work around to let admins manually edit H1 without making them editable for the users?

Thank you for your help !

Hi,

The easiest way to implement this is overriding these template parts via a child theme:

hivepress/templates/listing/view/page/listing-title.php
hivepress/templates/listing/view/block/listing-title.php

You can do this by copying them to the child theme folder, keeping the folder structure relative to “hivepress” https://youtu.be/LkojYp-8uwY?si=XFUIqBgAG3KWB9eD&t=268

Then you can create a custom Text attribute in Listings/Attributes, and name it (for example) “custom_title”. Then, in the overridden template parts you can check if this attribute is not empty:

if($listing->get_custom_title()) {
    echo esc_html($listing->display_custom_title());
} else {
    echo esc_html($listing->get_title());
}

If you don’t mark this attribute as Editable, then only admins will be able to fill it. This way, listings will show their default titles unless this custom field has any text, then it will be displayed instead.

Hope this helps.

Hi,

Thank you for your answer.

It seems that I can’t find the folder “templates”

It seems that it’s the main theme folder on the screenshot, not the HivePress plugin folder. Please copy template parts from the plugin’s hivepress/templates folder to the child theme’s hivepress subfolder, keeping the structure (please check the linked video for example, it’s linked to the timecode with the example).

Hi Ihor,

I followed your instructions step by step, and everything worked perfectly!

Thank you so much for your time and support—you have no idea how much I appreciate it.

Best regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.