Deactivate Title in the listing form

I would like to deactivate the title when adding a listing in the listing form.
I use this php code to make the title not mandatory

add_filter('hivepress/v1/models/listing',
    function( $form ) {
        $form['fields']['title']['required'] = false;

        return $form;        
    },
    1000 
);`

and this css code to hide the title

.hp-form__field--text {
    display: none;
}

These codes works but we add a listing, a doesn’t not work. Nothing happen when I click on add a listing. Is it possible to deactivate the title and make the form work ?

Thank for your help.

Hi,

Please provide more details on what exactly you want to replace the title with, as there will be a problem on the backend side if you delete the title.

As a workaround, we recommend specifying a title that will be generated automatically using this doc: How to generate listing titles automatically - HivePress Help Center (it will automatically hide the title field in add listing form, and where you need to hide it, for example, in the listing block, you can add CSS tweaks).

Hello
This help to hide the title and generate it automatically but once generated I am not able to modify in the back office of the website. Would it be possible to generate the title and then modify it after ? Thanks.

I use this token : %listing.categories% %listing.location but The location part did not works. Is it normal ?

Thanks.

Hi,

Please try using the following token for location: %listing.location%. If you have enabled generation and specified tokens, the title will be generated and displayed on the backend for all listings. Yes, you can hide the title from the frontend, but you will need a custom code.

Hello
Thank for your help but I still don’t know how to modify the title generated through tokens. It is actually not possible to modify it in the backend. Please inform if this is possible ?
Thanks.

Hi,

Yes, if the automatic generation feature is configured, you will not be able to manually change this title. You can try another way, but it requires a custom implementation.

Hello
Can you guide/ give more details on this way. I have some dev skills but I just need more infos about the theme and specific guidance.

Thanks.

Hi,

You can make the title field optional using the model hook and then hide the title field in the listing_update form.