Skip Navigation

[Resolved] Relating Repeating Fields Group to parent post in separate views

This support ticket is created 4 years, 10 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 3 voices.

Last updated by rusty 4 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#1517519

I'm trying to create a tabbed agenda for an event. I have a post type (Agenda Days) that contains a repeating field group. A new post is created for each day of the event, and the repeating field group is used for each time slot on that day.

I've created a view that loops through each post of the Agenda Days post type, and another view that loops through each time slot on each day. This works fine if I want a simple list like this:

Day 1
8:00 - 9:00 item 1
9:00 - 10:00 item 2

Day 2
8:00 - 9:00 item 1
9:00 - 10:00 item 2
etc.

However, I want to put each day in a tab and have the time slots for that day in the content pane of that tab. I'm using Foundation for my front-end framework, however the functionality is very similar to Bootstratp.

Unlike accordions, where the title link is immediately followed by the content for each accordion, with tabs, I need to separate the tab code from the content code so the output is like this:

<!-- THE TABS -->
<ul class="tabs" data-responsive-accordion-tabs="tabs small-accordion medium-tabs" id="example-tabs">
<li class="tabs-title">DAY 1 TAB
<li class="tabs-title">DAY 2 TAB
<li class="tabs-title">DAY 3 TAB

<!-- THE TAB CONTENT PANES -->
<div class="tabs-content" data-tabs-content="example-tabs">

<div class="tabs-panel" id="day-1-slug">
DAY 1 REPEATING FIELDS
</div>

<div class="tabs-panel" id="day-2-slug">
DAY 2 REPEATING FIELDS
</div>

<div class="tabs-panel" id="day-3-slug">
DAY 3 REPEATING FIELDS
</div>

</div>

However, the repeating fields view need to be inside the Agenda Days view in order to relate the proper content to the proper days. This creates a problem in that the div that wraps the tab content (tabs-content) gets repeated with every item in the loop so the tabs don't work. If I simply place the two view shortcodes one after another on a page, the repeating fields view returns "No items found". My guess is that since the repeating fields shortcode is not inside the Agenda Day view, it has no idea what content to display in the tab content pane.

So the question is this: is there a way to relate the repeating field group of a post to its parent post even if they are not in the same view?

#1518351

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would like to take a look at your structure first - Can you please share problem URL and access details.

Also, can you please share one example event page and tell me what is your expected output. Maybe a screenshot would help.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1520295

Hello,

Minesh is on holiday, will be back on Monday, he will get in touch with you when he is back.

#1525039

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've created a new view that will be used to display the tabs:
=> hidden link

Then, I've added the above view to your "Agenda Day View" view:
=> hidden link
- Where I've adjusted the view content as given under:

[wpv-layout-start]
	[wpv-items-found]
<div class="grid-container">
  [wpv-view name="display-agenda-tabs"]
  <div class="tabs-content" data-tabs-content="example-tabs">
  <!-- wpv-loop-start -->
	<wpv-loop>
        [wpv-item index=1]
      	<div class="tabs-panel is-active" id="panel-[wpv-post-id]">
			[wpv-post-body view_template="loop-item-in-agenda-day-view"]
      </div>
      [wpv-item index=other]
      	<div class="tabs-panel" id="panel-[wpv-post-id]">
			[wpv-post-body view_template="loop-item-in-agenda-day-view"]
      </div>
	</wpv-loop>
	<!-- wpv-loop-end -->  
  </div>
</div>
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found day view[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

And adjusted the child view that display the Repeating field group as you can see with that view:
=> hidden link

I can see its working as expected. Can you please confirm it works at your end and as expected 🙂

#1525243

Thanks Minesh! This is perfect. I see exactly how I was going about this wrong. Thanks a million for the clear explanation!