Skip Navigation

[Resolved] Adding non-repeating content on a custom archive

This thread is resolved. Here is a description of the problem and solution.

Problem:
Client has a custom WordPress archive, and wants to add some content at the top of the page before the archive loop results.

Solution:
The Loop Output section of the custom archive (and, likewise, a View) is just HTML (with lots of shortcodes that will generate more HTML). The part in between the wpv-loop tags will contain the archive results, but you can place additional markup outside of these, e.g. after the wpv-layout-start shortcode.

This support ticket is created 6 years, 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#913383
this-is-what-I-want.png
how-it-looks-like-within-a-single-custom-post.png

Hello Toolset Team,

I found myself struggling with creating an archive template for a custom post type, which I defined with Toolset.

As I use the Divi Theme, I followed the instruction, which is linked below. I managed to design the display of the WordPress Loop on the archive page without any further problems.

https://toolset.com/documentation/recommended-themes/toolset-divi-integration/design-archives-for-custom-post-types-with-divi-builder-and-toolset/

My question now is: How can I proceed to design an additional section above the WordPress Loop Section to show e.g. an advertising banner or an e-mail subscription form using the divi builder? Unfortunately, all my efforts have yet ended with the display of the additional section above every custom post within the archive loop...

Looking forward to reading from you!

Thank you very much in advance and best regards!

Philipp J.

#913401

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Philipp

When you create a custom WordPress Archive the Loop Editor will look something like this:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
		[wpv-post-body view_template="Loop item in Home/Blog"]
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-pager-archive-nav-links output="bootstrap" first_last_links="true"]
[wpv-layout-end]

Yours may look different depending on the output format you choose using the Loop Wizard.

The key point is that everything inside the wpv-loop tags will be repeated for every post in the archive (in this case the linked template, which you are designing with Divi).

You can edit the above markup to include extra content. Whatever is outside the wpv-loop tags will be shown only once.

If you want something to appear above the archive results you could insert a DIV with whatever content immediately after the wpv-layout-start shortcode for it to appear in all case, or immediately after the wpv-items-found shortcode for it to appear only when there are results to show.

Note that you are inserting HTML markup here (which can include Types and Views shortcodes), you are not designing this part with Divi.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.