Hi there,
Based on @ruenel’s great help with my FAQ page, I have now reused that for my rather intrucate documentation Page and a documentation contents Post type (Dokumentationsinhalte). Yet, I have difficulties, properly looping and sorting my custom post fields.
In my setup, every post_type item is either a documentation section or a subsection (radio button to select sits on top), hierarchically sorted in WP as parents and children ‘pages‘.
As with my FAQs, I want to use a Tabs element to switch between my product_categories
Taxonomy and display the Post titles pertaining only to that product (otherwise leave blank).
On the left Col, I’d like to have a numbered list of the sections (bold) and subsections (normal weight), sorted by its respective sections_index
and subsections_index
fields via meta_value_num
(with proper parent-child relation in ACF). Clicking on the section shall open the respective slide carrying all the posts, clicking on the subsection shall jump to that particular post via an anchor link.
The right Col shall display a Slide with all the subsection
objects of the selected section
with its subsections_title
and a repeater row which itself might have a subsection_images
row to populate a modal toggle and its modal content (currently hidden and replaced with Images element due to looping issues).
Title: subsection --> subsection_title
Text: subsection --> subsection_rows_repeater --> subsection_row
Row with Modals: subsection --> subsection_rows_repeater --> subsection_images --> subsection_image
How do I correctly query my objects in the table of contents and the main view?
I already tried:
$args = array(
'post_type' => 'documentation',
'tax_query' => array(
'relation' => 'AND',
array(
'post_parent' => $current_page_id,
'order' => 'ASC', // You can change the order if needed
'orderby' => 'index', // You can change the sorting order if needed
'posts_per_page' => -1, // -1 to display all child pages
),
array(
'taxonomy' => 'product_category',
'field' => 'slug',
'terms' => '{{dc:term:slug depth=0}}',
),
),
);
What that does not seem to work.
Do I need to nest my CPT objects in the main view, alternating on every tree level between e.g. {{dc:acf:post_field field="subsection_rows_repeater}}
and{{dc:looper:field key="subsection_row"}}
??
It turns out to be very, very tricky.
Any help or text page copy is highly appreciated …! Link to the site attached.
Kind regards from Germany,
Jens