Support » Themes and Templates » Loop with Parent and Child page content

  • I’m trying to do the following functions and need a little help.

    I want to display a list of Pages with Titles and Content. Some Pages have children. The default loop will display a list of all Pages within their own unique DIV. If a Page has Children, can I wrap the Parent Page and its Children within their own unique DIV?

    Here is the structure I’m looking for:

    <div>
      <div><h2>Parent Title One</h2><p>Parent Content One</p></div>
      <div><h3>Child Title One</h3><p>Child Content One</p></div>
      <div><h3>Child Title Two</h3><p>Child Content Two</p></div>
      <div><h3>Child Title Three</h3><p>Child Content Three</p></div>
    </div>
    <div>
      <div><h2>Parent Title Two</h2><p>Parent Content Two</p></div>
      <div><h3>Child Title One</h3><p>Child Content One</p></div>
      <div><h3>Child Title Two</h3><p>Child Content Two</p></div>
      <div><h3>Child Title Three</h3><p>Child Content Three</p></div>
    </div>
    <div>
      <div><h2>Non-Parent Title</h2><p>Non-Parent Content</p></div>
    </div>

    Is this possible within one Loop?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Loop with Parent and Child page content’ is closed to new replies.