Site logo

Archived topic

HTML code on a specific sub-menu page

7 replies · Started by Adam on December 8, 2020

Viewing posts 1–8 of 8

Hello team,

I am looking to add an HTML code to a specific sub-category page. [https://inadamsshoes.com/category/travel-blog/road-trip/]

Stories >> Travel >> Road Trip

Stories is part of my main menu, Travel is a sub-item of Stories, and Road Trip is a sub-item of Travel.

Additionally, When opening the "Road Trip" page on my site, I would like the new HTML code to be placed under the featured article.
I have one article that displays itself at full-width at the top, and then the rest of the articles follow underneath in two columns. Ideally, I would like to have the HTML (which is an opt-in.. if that matters) placed underneath the full-width feature, and the following articles in the columns.

Hopefully this description isn't too confusing.

Hi there,

Not sure if I fully understand. Any chance you have an example to show?

If it's relatively simple then we can try to point you in the right direction.

Let me know :)

I don't have an exact example to show you.

This might be less convenient than I had imagined, but I created a mock image to use as my example.

The HTML I am trying to place, is the same as the one at the bottom of my "Resources" page. The "Don't Know What to Pack" Optin-in form.

Hope this helps..

So basically you are trying to add some content after the featured post of a specific category archives?

Unfortunately there is no hook there.

correct, that is what I am trying to accomplish it seems..

correct, that is what I am trying to accomplish it seems..

As Leo mentioned, there's no hook that goes directly after the featured post.

To achieve this, you'll have to create a child theme with template for the blog, archive and search pages that adds a if( $loop->current_post && !($loop->current_post == 1) ) { echo 'your HTML markup here' } condition.

Alternatively, if you're adding in a static markup, you can insert markup after a target element with JavaScript.

Wow. Alright, thanks. Seems like more of hassle than it worth.

Wow. Alright, thanks. Seems like more of hassle than it worth.

No problem. :)

This archived topic is closed to new replies.