Archived topic
Category Archive Page Conditional Tag Help for GP Hooks
5 replies · Started by Derek on July 28, 2018
Hi,
I need a conditional tag for another GP Hook that I want on my category archive pages only. I can't find one on this FAQ:
https://docs.generatepress.com/article/using-hooks-conditional-tags/
Thank you!
Hi there,
This should help: https://codex.wordpress.org/Conditional_Tags#A_Category_Page
That being said, I would highly recommend you to try GP premium 1.7 (currently in release candidate so we believe it's stable):
https://docs.generatepress.com/article/beta-testing/
The new Elements module will replace this php method writing method and make your life a lot easier. Take a look here:
https://generatepress.com/gp-premium-1-7/
Thanks Leo I've gone ahead and upgraded and I can see how this will help A LOT moving forward. There is just one problem though...I do not know how to write the php. I was just copying the code from previous hooks. Here is the code format I was going off previously:
<?php if ( is_single() ) : ?>
[fl_builder_insert_layout slug="categories"]
<?php endif; ?>
How can I change this to not include a condition?
<?php [fl_builder_insert_layout slug="categories"] <?php ??????? It's not working so I know I'm way off :P
Hi there, if you're using GP 1.7 Elements then you just need to add the [shortcode] to the hook, check the Execute Shortcodes and then set your display rules. No need for PHP
Ooooooh. Hi David. Yeah, I tried that already, because I assumed that was how the new elements worked, but I hadn't seen the execute shortcodes check box :P
It works great. VERY useful! I can't wait to start using this more now that I understand how it works :)
Yes it has endless possibilities :)