Display page and child page content in loop
-
I’m trying to build a loop that displays content from a custom post type, and if the post has child pages, loop through and show content from the child pages.
Should end up with something like this:
<div id="myloop"> <div class="post no-children"> <h2>Post Title</h2> <p>Post excerpt</p> </div> <div class="post parent has-children"> <h2>Post Title</h2> <p>Post excerpt</p> <div class="child"> <h3><a href="child-permalink">Child Post title</a></h3> child thumbnail image <p>Child excerpt</p> </div> </div> <div class="post no-children"> <h2>Post Title</h2> <p>Post excerpt</p> </div> <div class="post parent has-children"> <h2>Post Title</h2> <p>Post excerpt</p> <div class="child"> <h3><a href="child-permalink">Child Post title</a></h3> child thumbnail image <p>Child excerpt</p> </div> </div> </div>
Is this possible? I’m just not familiar enough with queries to make this happen.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display page and child page content in loop’ is closed to new replies.