Site logo

Archived topic

Change Div Tag of Query Loop to Article Section

10 replies · Started by jaypabs on August 22, 2022

Viewing posts 1–11 of 11

I've been using Thesis theme before. And the top 10 recent posts in the front page is formatted as Article section as show below:

Article section

In GeneratePress query loop, how do I format it to use Article section instead of Div tag as shown below?

Query loop

I found that you have some semantic in Query Loop widget but it's lacking the Article.

Semantic

Is it possible that you can add it? Or else I have to buy Elementor plugin just because of this.

Hi Jomar,

There’s a filter for this. Specifically - generateblocks_container_tagname. I raised a bug ticket as there might be a bug regarding it and the tag name for the Query Loop Block.

You can find it here: https://github.com/tomusborne/generateblocks/issues/665

Hi Fernando,

Thank you for acknowledging this. I hope this can be fix ASAP as this is very important for SEO.

You’re welcome Jomar! Hopefully it does.

Just an update. We temporarily created a script to add the "article" semantic.

Please see screenshot below.

article semantic

However, the first "article" above should be change to "div" or maybe "section"?

Hi there,

for the GB issue, we will be adding options for the article element tag.

The second issue, the article element is itself a sectioning element and its perfectly valid to nest another article within it.

If you want to change the top level tag then you would need to create your own child theme copy of the content-single.php

https://github.com/tomusborne/generatepress/blob/8c515ebb1b74637a8bd8a38f7bfaa55e22101b52/content-single.php#L13

or content-page.php

https://github.com/tomusborne/generatepress/blob/8c515ebb1b74637a8bd8a38f7bfaa55e22101b52/content-page.php#L13

And update the tag and closing tag as required.

Hi,

I forgot to mention that I am using this page on my frontpage. That's why I need to change the article element to something like section or div.

I already added content-page.php to my child theme and created a condition that if the page is in the frontpage it will change to section else use article.

Is that working for you now ?

Yes, though I have temporary fix on the first issue which is the options for the article element tag. I still wanted that you integrate it on the next update. This is very important for SEO.

Glad to hear that.

The article template tag will be added to the plugin very soon.

This archived topic is closed to new replies.