• Resolved philipt18

    (@philipt18)


    I don’t think there’s a way to do this, so I’m requesting it. When setting up a loop like:

    [loop type=page parent=this include=children]

    I’d like a way to specify how many generations of children I want it to check. The above checks all children, and of their children ad infinitum, and

    [loop type=page parent=this]

    might be considered checking one generation of children. I’d like to be able to specify 2 generations, or 3, or whatever.

    I’m not sure how I would do it. You have include=children but could also have children=yes mean the same thing and be the same as children=1, and then allow children=2 to check two generations, etc.

    I think it would be useful.

    https://wordpress.org/plugins/custom-content-shortcode/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    In the newest plugin update (3.6.0), I did a complete rewrite of the include=children feature. The way I had it implemented was somewhat limited. Previously, children were appended after their parent wherever they occurred; now all descendants are included as equals and follow loop query parameters like orderby.

    It functions much better, but this is a change from previous behavior, so please test any code using include=children.

    In addition to the above change, there is a new parameter level to set descendant level (number of generations). When this is set, there’s no need to set include=children. It’s used like this:

    [loop type=page parent=this level=2]

    There’s a note about this in the documentation, under Main -> Loop -> Parent/Children.

    This is related question, and refers to changes to the include=children feature.

    The code below placed on any page generated a bulleted list of the custom posts and any children and grand-children, etc. This code now only leaves a blank page. I am not sure how to achieve this with latest changes to the feature.

    [loop type=custom_post include=children orderby=title list=true clean=true trim=true]
    [field title-link][/loop]

    Thanks Eliot

    Thread Starter philipt18

    (@philipt18)

    Thanks Eliot.

    Plugin Author Eliot Akira

    (@miyarakira)

    Hi Jimmy,

    I found that list=true was conflicting with the new way that children are collected together. I fixed this in the latest update 3.6.1.

    Hi Eliot
    Just updated and tested. The following is not working as expected – i.e. a bulleted list with indented children.

    [loop type=custom_post include=children orderby=title list=true clean=true trim=true][field title-link][/loop]

    Plugin Author Eliot Akira

    (@miyarakira)

    I see.. For a list with indented children, it needs the previous behavior (listing children after their parent). I’ll have to make an exception for list=true and re-implement the old behavior. OK, let me look into it.

    Works perfectly. Thank you.

    i think this may be related, i have this:

    [for each=custom_tax parents=true]
    //html for first level taxonomy
    [-for each=child]
    //html for second level taxonomy
    [loop type=horarios level=1]//find every parent post under this taxonomy
    [-loop type=horarios parent=this]//find every child of this parent post and do something[/-loop]
    [/loop]
    [/-for]
    [/for]

    The problem im having is that the child posts have no taxonomy and the loop is looking for child posts that also have the same taxonomy as the parent, you think there is any way that i can get all of the child posts without having to add the same taxonomy as the parent post?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Number of generations of children’ is closed to new replies.