We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49542
    • 2 Posts
    Can getResources to skip children when the parent is unpublished without having to unpublish every single child resource?

    I think because of how I am calling getResources it is disregarding the parent completely as I need to access content 2 levels down. So I wonder if my logic is flawed to achieve this.

    I am using getResources and getPage to output content from my entire site tree (essentially a product catalogue).

    My resources looks like this:

    Child (Published)
    Content I want
    Content I want
    Child (Unpublished)
    This is published, but I don't want it output
    Parent 2 (Published)
    Child (Published)
    Content I want
    Content I want

    GetResources is retrieving my records but it is ignoring the published status of the child's parent. Each parent has quite a lot of content, so I really don't want to "unpublish" each child.

    My snippet call is:

    &parents=`2,3,4,5` // the master "categories"
    &depth=`2` // I don't want the direct children, I want the children's children

    Hope this makes sense. Thanks.
    • Do the children that you want have a template in common? If so, perhaps you could use a "where" property to only get the ones with that template?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org