Join our new community forum for support & discussion

Join Now

Home Support Themes RentalHive Category dependent attribute descriptions

Category dependent attribute descriptions

  • Author
    Posts
  • sowickesited

    I’m using the RentalHive theme with the Geolocation and Social Links extensions.

    Is it possible to change the listing_update form attribute descriptions depending on the category?

    For example…

    Category A would have a description for the Title attribute.
    Category B would have a different description for the Title attribute.

    I have 2 categories:

    1. For Sale (category 44)
    2. Rentals (category 45)

    These are hard-coded attributes such as Images, Title and Description as well as geolocation and social links fields such as Location, Website, and Instagram. These attributes are not managed by WP Admin under the Listing attributes so you cannot use WP Admin to set the field descriptions.

    So I am using this code in my functions.php file to set these field descriptions:

    add_filter(
      'hivepress/v1/forms/listing_update',
      function( $form ) {
        if ( isset( $form['fields']['title'] ) ) {
          $form['fields']['title']['description'] = 'Title description goes here.';
        }
        return $form;
      },
      1000
    );
    ihor developer

    Please try using the hivepress/v1/forms/listing_update/fields hook instead https://hivepress.github.io/hook-reference/hivepress_v1_models_%257Bmodel_name%257D_fields.html This way you can get the current listing ID, get categories and set different descriptions depending on the category.

Viewing 2 posts - 1 through 2 (of 2 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.