How to hide certain listings based on listing create date

I am working on a cat selling market. I wanted to be hiding certain listings depending on the date from which a listing was created. I can’t find the listing-archive.php or any associated php file that compiles title, image and listing created date just like the HivePress post-archive.php

Hi,

Unfortunately, there’s no such feature, it would require a custom implementation. As a workaround, please try this feature: How to add a listing expiration date - HivePress Help Center

​I hope this is helpful to you.

There’s no specific listing archive file because all the templates in HivePress are defined as arrays of blocks and template parts. If you want to hide listings by some criteria, I highly recommend using the pre_get_posts filter, there you can check if it’s the main listing query on the front-end, and then add custom criteria for the WP_Query to filter listings by date. This is the easiest way that doesn’t require editing templates.

Another approach is setting the listing expiration date, then listings will expire automatically within a specific number of days after the publication. This workaround doesn’t require code changes.

Hope this helps.

How can I use the pre_get_posts filter if I need to hide. and where can I use it

Hi,

Sorry, we can only provide general guidelines, so we can’t provide you with advice on how WordPress core functions work. I recommend checking out this topic for more detailed information, where you can find a PHP sample: Randomize listing order code still dysfunctional