Filtering Listings on a Custom Page (Categories) — Different Behavior from Default Listing Page

Hi everyone, I need some help with customizing my HivePress setup.

I’m using the loan_type taxonomy to filter my listings (hp_listing post type).

  • On the default listing archive (/?post_type=hp_listing), the filters work fine when I pass parameters like loan_type[]=162.
  • But on my custom page called “Categories” (/categories/), where I’m displaying listings using a custom WP_Query, I’m not sure how to make the filters work the same way.

:right_arrow: Example working URL on the archive page:
https://getfundsnow.localcontractorsfinder.com/?post_type=hp_listing&loan_type[]=162

:right_arrow: Example not working on my custom page:
https://getfundsnow.localcontractorsfinder.com/categories/?loan_type[]=162

On the categories page, I’ve created a template and added a WP_Query with a tax_query, but it’s not applying the filters as expected. Here’s my query code:

php

CopyEdit

$args = [
    'post_type' => 'hp_listing',
    'posts_per_page' => 12,
    'tax_query' => [[
        'taxonomy' => 'loan_type',
        'field'    => 'term_id',
        'terms'    => $loan_types,
    ]],
];

I also tried using a shortcode instead of a template, same result.


Question:
:check_mark: What’s the correct way to replicate HivePress’s filtering behavior on a custom page?
:check_mark: Should I manually rebuild the query the same way HivePress does? Or is there a HivePress hook/shortcode I should use instead of WP_Query?
:check_mark: Can I reuse the HivePress filter processing logic on a custom page like /categories/, or should I just redirect users to the archive page?

Any help would be greatly appreciated!

Hi,

Thanks for the request. Please clarify how exactly you created this custom template and query (for example, via the pre_get_posts filter and hook, or how you changed the query listing).

For our part, we highly recommend using the currently available API. If you describe the result you need, we will try to provide a solution or workaround.

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