Support » Plugin: Custom Content Shortcode » loop through parents of post but only grab the highest/first

  • I would think this code would output the title of just the top level parent, but it only grabs the closest parent. This may be by design so I wouldn’t call it a bug.

    My page structure, created in this order, is
    Farm > Animals > Chickens

    Here is my loop:
    [loop type=page parent=same list=true count=1][field title][/loop]

    It outputs ‘Animals’

    In order to do what I need, it needs an [if] but also queries more than I want and iterates unnecessarily through the non-first items. Any suggestions?

    Example:
    [loop type=page parent=same list=true][if first][field title][/if][/loop]

    Thanks!

  • The topic ‘loop through parents of post but only grab the highest/first’ is closed to new replies.