Archived topic
Only activate/display Element Hook on first page of Post Category Archive
4 replies · Started by Pete on December 10, 2021
I have inserted an image generate_after_archive_description using the Element Hook on the XYZ Post Category Archive location. The archive runs over many pages. I only want the hook to be activated on the first Post Category Archive page e.g. https://www.abc.org.au/category/clubs but not the subsequent pages e.g. https://www.abc.org.au/category/clubs/page/2 and so on. Is there a way to work around this?
Ahhhh, I've had a look at the class and there's the .paged class. I'll try that.
Hi there,
you can use the generate_element_display filter to disable an element when viewing a paged object.
See here for an example PHP Snippet:
Adding PHP: https://docs.generatepress.com/article/adding-php/
Brilliant, thanks David.
You're welcome