-
Valerrr
Hello, I have created all categories on the website using a single element (Element type: Loop Template).
However, I now need to add one element immediately after the H1 heading (only in certain categories). I tried using the hook after_archive_title, but since H1 is created using GenerateBlocks, it probably doesn’t work.
Is there a simple way to insert it where I need it using an element?
Thank you
-
Hi there,
I would recommend using ACF plugin to create a custom field for the categories, and pull the term meta via a GB text block. You can add the text block below your current H1 in the same element.
-
Valerrr
Hello, please take a look at the page and the image, maybe you will think of something else.
The thing is that in certain categories I want to sort the content into subcategories and ideally place them under the H1 heading. It’s a simple navigation – ul – li.
So the only option is to have a separate element for each category or use the ACF plugin? Can you think of anything else?
Thank you 🙂
-
I want to sort the content into subcategories and ideally place them under the H1 heading. It’s a simple navigation – ul – li.
I don’t understand what you mean. Do you mean you want to show subcategories of every parent category? If so, you might need a custom function to create the sub-categories first, eg. a shortcode, then you can add it below the h1 title.
-
Valerrr
I’ll try to explain it in simple terms.
For certain reasons, I don’t want to create a separate Element (Loop Template) for each category. Instead, I’ve decided to create just one universal Loop Template that applies to all post categories on the website. (This works without any problems).
Where is the problem? In certain categories, I would like to add a subcategory navigation which I’ve already built using GenerateBlocks. The ideal location is between the H1 heading and the Query Loop section.
I thought about using the after_archive_title hook, but it doesn’t work because I am using a GB HEADING block inside my Element, which replaces the default title hook.
What interests me? Is there a way to keep just one Element (Type: Loop Template) and use a custom hook (or another method) to insert this navigation into it? I need it to appear only in certain categories and specifically in the spot between the H1 and the Query Loop.
Ideally without any additional plugins.
Image: https://imgur.com/a/FtWb4tL
-
You will need to use CSS to hide them on certain archives.
If you have GB Pro, you can create location condition for the block, so they only appear on certain archives.
-
Valerrr
I’ve already sorted it out.
-
Glad to hear that 🙂
- You must be logged in to reply to this topic.