Editing the home search / the map

Hello, I have created a child-theme & would like to change 3 things:

  1. The default category displayed on the homepage - because the All-Categories (I have activated categories in search to remove them from the filters sidebar) does not show any filters.

  2. Display the map with the results on another page (my process idea would be: copying the listings page & removing parts of it).

  3. Add several locations for each listing.

I cannot find them in the source files (the location of these seems to be different from other wordpress themes I have edited before).

IT :wink: would be amazing if you could help me find where the files for this are or even the solution to these “problems” :slight_smile:

Greetings,
MadeInDex

Hi,

  1. If you mean that All Categories doesn’t show any filters, then most likely you have attributes linked to certain categories, and only when you select those categories will attributes be displayed.

  2. Please consider rewriting the template using this doc: How to customize templates - HivePress Help Center to rebuild the Listings page, as creating a separate page will require advanced customization.

  3. Unfortunately, there’s no such feature, it would require a custom implementation.

1 Like

Hi Andrii,
appreciate the quick response :+1:

  1. Please check the test installation, when you press search on the homepage / enter the listings page directly no filters are shown on the listings page it opens (same in the HivePress live demo). Even with all categories selected for all attributes.

  2. Would like to copy the listings page and then customize it (removing everything other than the map).

  3. I have customized a lot on a child theme & read most of your customization guides / watched the videos, but I can’t find the location of that file.

  • Also cannot find the 1. homepage search & the 2. listings page in the WordPress files, could you please tell me the location?

It seems to be outside the theme folder, but if i edit something else - will it not cause problems with HivePress updates?

I have customized WordPress themes before, but I have problems navigating in the HivePress files, some guidance would be very much appreciated! :slight_smile:

With best regards,
MadeInDex

Hi,

  1. This is the expected behavior, since the demo also doesn’t have a global search filters feature, it’s category-specific. If you don’t see any filter on the default search page, it means that this attribute is linked to a category (when you edit an attribute, you can select a category on the right.) Try editing the attribute and removing all categories from it, then it will work correctly.

  2. Yes, the best option is to overwrite the template in HivePress > Templates, you can specify the same blocks and create a new layout. Because there is no way to duplicate this page as it will require advanced coding.

  3. Here you need to change not the file location, but use hooks and add PHP snippets. You need to embed a new location field and write a custom search function for it if necessary.

1 Like

Hi,

  1. Thank you, this was the solution!
  2. Templates is empty, the available blocks are missing the map, the filters and the search results. I can work with PHP / JS, what would be the process? I’m not very used to WordPress, which is why I’m having problems to understand how your theme code works (it’s very different from other themes I inspected).
  3. Are PHP snippets the only simple method (other than creating a new plugin/extension) to change something located inside the HivePress plugin folder? As all the relevant blocks / files seem to be in it.

2. Is there a list of shortcodes (similar to the ones used in the video: Adding Shortcodes | HivePress Docs) - if I can somehow include the filters / map on a new page, customizing them would not be a problem, the issue is only finding the filter & map files/code and displaying them.

3. I have added the snippet to embed the new location fields & they show up in the listing form, however they are not displaying on the “listing” & “listings” page:

add_filter(
    'hivepress/v1/models/listing/attributes',
    function( $attributes ) {
        for ( $i = 2; $i <= 5; $i++ ) {
            $attributes['location_' . $i] = $attributes['location'];
            $attributes['location_' . $i]['label'] = 'Location ' . $i;
        }

        return $attributes;
    },
    1000
);

How to display these fields on the front-end & make the label change from “Location” to “Location 1-5”?

With best regards,
MadeInDex

Hi,

  1. There’s a shortcode for every public block you see in the HivePress block category in the editor (named in the same way as the block, just with lowercase and underscores), but unfortunately there are no map and filters form shortcodes, you can use these blocks in the context of the Listings template in HivePress/Templates though (I highly recommend this over creating a separate Listings page to reproduce its layout). Also, even if the map is rendered it would be always empty outside of the search results context (which is available on the built-in Listings page only).

  2. There are 2 ways, using code snippets (to override the functionality via hooks) or the child theme (to override specific template parts). Please don’t edit any main theme/plugin files directly as these changes would be erased on the next update, you’d have to reproduce these changes every time and keep track of the changes.

The snippet which adds new Location fields seems to be ok, but this requires further customizations, please note that we can only provide general guidance regarding customizations beyond the available features. You can try adding “display_areas” as an array for each of these attributes, e.g. “page_primary”. I also recommend using var_dump to check how other attributes are configured.

Hope this helps

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