Run WordPress loop within a loop
-
Hey guys,
I have a two custom post types:
– Products
– and SymptomsThe products are displayed in a excerpt format on the products page and grouped according the products category (custom taxonomy). The code is pasted on Pastebin on the following url: https://pastebin.com/K1TvtgBA
The product single page is as follows: https://pastebin.com/ZJeRauJT
The Question:
I want to run a custom query (I have tried: WP_Query & query() ) to return the custom posts within the associated symptoms div on the single page. It works, but breaks my single page loop. The moment I run the loop, I am unable to display:
– Indications
– and Contra-IndicationsWhat is the best method to run the loop within the already existing loop. What the symptoms actually do is retrieve a bunch of related symptoms (related to product based on custom taxonomy).
Someone said that I should not use (the_post) as that is the default WordPress post – tried that and I obtained the same results.
Any additional suggestions?
- The topic ‘Run WordPress loop within a loop’ is closed to new replies.