Tell us what you are trying to do?
TLDR: How do you display nested repeated field groups in a single template? I've read all I can find and the snippets of information (some old, some new...but never a complete solution or one that seems to work).
I want to display two sets of RFGs from a single post field group on a single CPT, on a per post basis. Seems easy enough, but the structure of nested RFGs and what has to be done to make them work is challenging for me. "Parent" and "Child" makes sense in many cases, but across all the support and tutorials I have read, these terms fall flat and I struggle to relate them to my exact scenario. Your help would be greatly appreciated.
I have a CPT named Newsletter.
I have a Post Field Group named Newsletter Fields.
Newsletter fields contains: 3 single fields, an RFG, containing fields and another RFG. Structurally, this is my list of fields in the Newsletter Field Group:
1. volume
2. number
3. date
4. [RFG1] = "H2 articles"
a. H2 sort order (number)
b. H2 Title
c. H2 Body
d. [RFG2] = "H3 articles"
i. H3 sort order (number)
ii. H3 Title
iii.H3 Body
I set the Post Field Groups this way to give content authors an easier time writing the newsletter. There will ALWAYS be a list of articles at the H2 level. Some articles at the H2 level may (or may not) have sub-article(s) (H3 level, [RFG2]). I have structured it this way because I'm displaying a table of contents using "LuckyWP Table of Contents" Plugin for ease (I'm not much of a coder).
My expectation, and it seems possible but I have spent HOURS trying...Is to see something like this after I view a single Newsletter CPT:
<h2>1. Welcome to our Club (title)</h2>
<p>H2 body text...Lorem Ipsum...</p>
<h2>2. New Members</h2>
<p>H2 body text...Lorem Ipsum...</p>
<h3> a. John Smith</h3>
<p>H3 body text...Lorem Ipsum...</p>
<h3> b. Susan Jones</h3>
<p>H3 body text...Lorem Ipsum...</p>
<h3>c. Ben Johnson</h3>
<p>H3 body text...Lorem Ipsum...</p>
<h3>d. Alice White</h3>
<p>H3 body text...Lorem Ipsum...</p>
<h2>3. Party - Save the Date</h2>
<p>H2 body text...Lorem Ipsum...</p>
<h2>4. Did you Know?</h2>
<p>H2 body text...Lorem Ipsum...</p>
<h2>5. Events at Upcoming Meeting</h2>
<p>H2 body text...Lorem Ipsum...</p>
<h3>a. Ice Cream Social</h3>
<p>H3 body text...Lorem Ipsum...</p>
<h3>b. Massive Layoff Announcement</h3>
<p>H3 body text...Lorem Ipsum...</p>
<h2>6. Contacts </h2>
<p>H2 body text...Lorem Ipsum...</p>
So, based on my structure above, newsletter authors will create a single newsletter with repeating fields for "title" and "body." The Table on Contents does exactly what I need it to do.
I cannot figure out how to display [RFG2]. No matter what I do I only get [RFG2] (the parent)?. There is a lot of content peripherally related (a couple helpful posts suggested using legacy Views, using shortcodes in the classic editor, making a Relationship filter for the parent on one thing and the a filter for the children something else...but then I keep getting to this stuck point. I have read things like "then just add your shortcode to the parent view." How? Where?
I'm not complaining, I absolutely love your plugin, but the learning curve is steep. I think part of what is difficult is to be expected - your company has grown and matured the products. Classic vs. Blocks and their interplay. Shortcodes, or not. This project is a CPT with Custom Post Fields, with a parent and child RFG, with a view (or two?), a content template. I just need help, with examples, of how to connect to dots. I don't believe I'm asking for anything custom, I think I just need help doing what your awesome product (and this chemists not coder) can do.
Is there any documentation that you are following?
Yes. I have followed nearly every search result for the various search queries. Most of these come from your own support forums or tutorials. But In some ways, my needs are simpler (I don't believe I have to worry about relationships, outside of making sure queries are run on the same post (CPT) for both parent and child custom fields..
Is there a similar example that we can see?
No, I don't have it public yet, but I can get you an account to take a look at what I've been trying. As long as you don't judge me on the number of plugins (it's a risk, there can be issues, etc. etc. I know.). Yes, I have already disabled all plugins but toolset and reverted to twenty nineteen (staging site), but I still couldn't get it to work (because I am making a mistake I just know it).
What is the link to your site?
hidden link