• Resolved undfine

    (@undfine)


    This is similar to this post:“cant-get-field-value-inside-each-loop”

    I want to retrieve the post title or any other identifiable info from the post containing the repeater (in this case, an image gallery).

    I am creating a group of galleries (each it’s own post) with a gallery field.

    I want to use Pods templates to display the gallery images, but need a way to “relate” each image from its post by a common name/category for slideshow/lightbox and filtering. This seems pretty basic, and I had wanted to use the @post_title, but the each loop does not allow for this. I understand the context changes and theoretically why this doesn’t work, but any alternatives would be appreciated!

    As a feature request, it would be even better if there was a way to store a template variable, similar to TWIG templates, where it could be accessed from within the loop, and perhaps even allow for calculation.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Support Paul Clark

    (@pdclark)

    Due to the way [each] shortcodes are processed, it is not currently possible to access information about the parent object from within the each loop with Magic Tags. The alternatives are to write a custom shortcode using PHP pods()->field() for use in the template, or to have a bi-directional relationship field on the field being iterated by [each] which relates back to the parent.

Viewing 1 replies (of 1 total)
  • The topic ‘Get title or other Post content from within Each loop’ is closed to new replies.