Creating Dynamic Sitemap with Loopers

Hey!

I am trying to create a page that will serve as my sitemap. Ideally, I would like it to display all the “pages” of the site, and display them in their parent/child relationship. (kinda like below) There are also a number of specific pages I would need to exclude from this output (the sitemap page being one, and then an array of several others).

Ex:

Is this something that is easily done through Loopers? I’ve been struggling for a while to get an output of the current looper items immediate children.

I’m currently trying:

Parent Column with Looper Provider - Query String
post_type=page&orderby=title&posts_per_page=-1&order=ASC&post__not_in[]={{dc:post:id}}
Div level 1 as Looper Consumer
Div level 2 with Looper Provider - Query String
child_of={{dc:post:id}}
Div level 3 as Looper Consumer

But it isn’t working, nor do I even think my first query is correct, because it displays all the pages, including pages which are children pages. Any help would be great.

Thanks!

Hey I figured it out! This is what I got:

  1. Looper Provider on Sitemap Layer:
    post_type=page&post_parent=0&post_status=publish&post__not_in[]={{dc:post:id}}&orderby=title&order=ASC&posts_per_page=-1

  2. Looper Consumer on Level 1 Page using conditions to remove my excluded pages - I had to remove all pages with a certain strings in the title
    The conditions I used were something like:

    1. string1 [not in] {{dc:post:title}} [and]
    2. string2 [not in] {{dc:post:title}} [and]
    3. string3 [not in] {{dc:post:title}} [and]
    4. etc…
  3. Looper Provider on Level 2 Page which is also set as the Looper Consumer (copied for level 3, and 4)
    post_type=page&post_parent={{dc:post:id}}&post_status=publish&orderby=title&order=ASC&posts_per_page=-1

Hope this helps someone else! I know there are plugins that can do this, but I’d rather it all be within cornerstone.

Hi @michigancreative,

Glad that you are able to figure this out and share it with others.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.