Disable clicking for categories on the listing block

Hi guys,

Hope you are all well. I used the code snippet in this post to hide a certain category from the search form. And it works very well!

However when people click on the listing category label (see attachment 1


) they can still gain acces to the category page, only it is completely blank/empty (see attachment 2)

. This confuses the users. Since there are listings within this category, but i used the snippet to hide them…

I would either like the users to be unable to click or if they do click that on this specific category page (but not in the search) they can see the listings. Would this be possible?

Thanks

You can add this to Additional CSS to make categories unclickable on blocks:

.hp-listing--view-block .hp-listing__categories a {
  pointer-events: none;
}

If you also want to disable category clicks on listing pages and blocks use:

.hp-listing--view-block .hp-listing__categories a, 
.hp-listing--view-page .hp-listing__categories a {
  pointer-events: none;
}

This will effectively disable category links.

1 Like

Thank you, i’ve tried your solution, but the block gives back an error: Error loading block: Invalid parameter(s): attributes (see photo attached)

Am i missing something? When i ignore the error and save the page the block seems to be working as normal, but i can still click the category links.

Click the link: Login ‹ Voor theeliefhebbers ❤️ — WordPress

In the bottom section of the left slider, you’ll find Additional CSS. Paste the provided code there to disable categories from being clickable. :slight_smile:

I uderstand. Thank you! Works like a charm! Could you also tell me how i could disable the category link on the listing page? (one step deeper, so to say)

Thank you so much for all your help!

Hello,

I am sorry, i think i explained it the wrong way. I want to disable clicking for a specific category label belonging to a specific category (thee sommeliers), not all category labels. Is this also possible?

Sorry i solved my issue in a different way. I used redirection to redirect users to another page.

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