I have some layout changes that are being applied to the_content. I need to do one of two things, but neither is working as expected... either:

  1. Pass data to the filter so that it knows if it is a "loop inside a loop" (this pertains to a special post type events that are outputting multiple events on a given page). The problem is that the $post object inside the filter is returning the $post for the PAGE, and not the specific item where the filter is about to be applied, so using post_type will not work. I wonder if this is bad implementation on the part of the plugin author (calling $post->post_content in a non-standard way that is preventing me from accessing it).

  2. The other possibility would be to somehow detect "nested" loops, but the issue I have with this is that the main call to the_content() seems to be the last one firing, and I'm not sure there's a way to track number of times a loop has fired when I don't have public access to the length of that private wp_query() the plugin is executing for it's own post type.

Any thoughts on something to fix this... the issue is very significant since it's trying to embed HTML layout intended only for the main page, inside the inner-loop for events.

  • 4
    Please include actual code, it is much easier to understand code then prose ;) – Mark Kaplun Dec 16 '13 at 5:40
  • This should be possible, but the details are not clear. Are you editing a theme template, a plugin? What? And as MarkKaplun requested, include the code. – s_ha_dum Dec 16 '13 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.