Skip Navigation

[Resolved] How to add a div after the 6th result in Views?

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by StanleyT8485 3 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#2143519

Tell us what you are trying to do?
I want to add a div after the 6th result in Views. I just want to repeat this once not for every 6 result such as 6, 12, 18, 24, etc.

Any help would be greatly appreciated!

#2143763

Hello and thank you for contacting Toolset support.

I believe this will need custom code. However, I must suggest a limited solution that won't require custom code.

You can use two views, the first one will display the 6 first posts. The second one will skip 6 posts. And you put the div between them. This solution is limited because it would not handle pagination and search correctly. Basically, because those are two views instead of one.

Otherwise, this will require custom code. Two possible ways:
1. Inject a special post after the 6th post using a hook. Check the custom code in this similar, but slightly different issue, in this reply https://toolset.com/forums/topic/adding-a-static-item-to-a-view/#post-1660439
2. Use a custom shortcode that will output the div or (true, if you want to use it inside a conditional) only the first time. And using inside an wpv-item shortcode. Read more about it here https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-154400
And here https://toolset.com/documentation/legacy-features/views-plugin/digging-into-view-outputs/

I hope this helps. Let me know if you have any questions.

#2144167

My issue is resolved now. Thank you!