I’m using WordPress as my favourite cms software. Have worked with different WordPress specific queries like WP_Query, get_posts, query_posts, etc.
My question would be about the programming side. What if I ever will need to use for example a foreach loop inside a specific WordPress query->loop? I guess, sometimes it is not necesary to use wp loop inside another wp loop and it is recommended to use a simple php loop?
Thanks in advance!
You’re right. There are situations when it is not required to do another database query in an existing loop. In this situations you can use the
foreachloop.Example:
To see data stored in
$children, useprint_r():$children->IDis an example of an object property.Let me know.
Edit: More documentations about
foreach, here: php-net foreach loops