No filter display if category not selected

Hi,

Please post a topic on our forum, and our developer will help you with the information Development - HivePress Community.

Thank you for your understanding.

I created this new thread for it. I very much appreciate your time helping debug this issue!

Hi,

@luna This bug has been added to the bug tracker. However, if you need an urgent fix and there is a simple solution, we can add it to your site. Let us know if it works for you.

@andrii, Yes that would work for me. Thanks in advance!

Hi,

Please send the link to the temporary access again, as the previous one has expired.

I sent it. Thanks

I added the code snippet to your site, also posting it here in case if someone has the same issue:

add_action('wp_enqueue_scripts', function() {
	if(is_post_type_archive('hp_listing') && (!isset($_GET['_category']) || !$_GET['_category'])) {
		echo '<style>.hp-page__sidebar{display:none!important}.hp-page__content{flex-basis:100%!important;max-width:100%!important;}</style>';
	}
}, 100000);
1 Like

It works great! you are the best. Thanks :slight_smile:

Hi Ihor. Where exactly should I enter the code? Because unfortunately, I have the same problem…

Hi,

If you need to add this PHP snippet, please check this doc: How to add custom code snippets - HivePress Help Center

​I hope this is helpful to you.

I tried using a Code Snippets plugin, but unfortunately, it’s not working. Is the only way to use a child theme?

Hi,

For this snippet to work correctly, we recommend using the Code Snippets plugin to add it. If the snippet does not work, please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, make sure that caching is disabled for logged-in users.

Thank you Andrii, it’s almost okay now, but I have such an effect: now the “filter” button disappears after clicking on it. What should I do to make it completely invisible on the listing subpage?

Hi,

Please provide more details. What exactly do you mean by disappearing? Also, what exactly do you want to make invisible?

image
I want to hide the “filter” button because I don’t have any filterable attributes on the All Listing page.

Hi,

Please check this topic: I would like to hide the filter on the listing

This code works, but unfortunately only on desktop. How can we edit it for the mobile screen too?

Hi,

Please try to use this PHP snippet:

add_action('wp_enqueue_scripts', function() {
 if(is_post_type_archive('hp_listing') && (!isset($_GET['_category']) || !$_GET['_category'])) {
  echo '<style>.hp-page__sidebar{display:none!important}.hp-page__content{flex-basis:100%!important;max-width:100%!important;}.hp-button--listing-filter{display: none !important;}</style>';
 }
}, 100000);

​I hope this is helpful to you.

2 Likes

Great! Now it works excelent. Thank you very much Andrii!

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