• Resolved ksoares

    (@ksoares)


    We have a custom post type for articles that uses both taxonomy and relationships to other content – specifically, they related to resource documents. We wanted to use the Related Posts by Taxonomy plugin to show additional articles that have the same taxonomy term, and originally this worked fine with the plugin. However, once we added an internal loop in our page template to output all the resource document relationships, the plugin stopped working.

    Basically we have this:

    ——————–
    My Article (Taxonomy selected: “My Term”)
    Article text. Article text. Article text.
    Article text. Article text. Article text.

    Resource Documents
    – Doc 1
    – Doc 2
    – Doc 3

    Related Content by Taxonomy (Use taxonomy: “My Term”)
    – Related item 1
    – Related item 2
    – Related item 3
    ——————–

    The method we use to output all resource documents (the middle part of the diagram above) is set $posts to an array, then have an internal loop that calls setup_postdata and outputs a resource doc for each item in the array. At the end, it calls wp_reset_postdata when done. However, this internal loop seems to interrupt the display of related content by taxonomy (it simply fails to show). If we strip out our internal loop (taking out the calls to setup_postdata and wp_reset_postdata), then related content by taxonomy works again.

    Is there a way we can ensure the plugin will work while still having these internal loops for other content?

Viewing 1 replies (of 1 total)
  • Thread Starter ksoares

    (@ksoares)

    Tried moving the widget all over the place and found out it does work in other places, just not in the location where I want it. It even works after blocks that call setup_postdata/wp_reset_postdata, so I am assuming this is an issue that is not stemming from the plugin itself – closing this thread.

Viewing 1 replies (of 1 total)
  • The topic ‘Using setup_postdata / wp_reset_postdata seems to stop related posts from workin’ is closed to new replies.