Archived topic
How do I insert a separate CPT loop within the author archive loop?
1 reply · Started by Pete on September 22, 2015
Whoa, what a forum title!
I've made up an author.php template file combining everything into just that file. Half way into the loop I want to stop the loop, start and finish another separate loop then restart the first loop.
The second loop is one that lists all the post of a custom post type of that same author.
So it will be something like...
loop 1 start
loop 1 end
loop 2 start
loop 2 end
loop 1 start
loop1 end
I've added the code to pastebin as it's a bit long
http://pastebin.com/RZV4AF2u scroll down for the second loop.
Thanks :)
Pretty complicated, but should be do-able.
Take a look at how to use loops: http://codex.wordpress.org/The_Loop
Then you'll want to use the WP Query function: http://codex.wordpress.org/Class_Reference/WP_Query
You'll also want to make use of the wp_reset_postdata() function.
If you Google "WordPress loop within loop" you'll find lots of examples.
