[Resolved] How do I insert a separate CPT loop within the author archive loop?

Home Forums Support [Resolved] How do I insert a separate CPT loop within the author archive loop?

Home Forums Support How do I insert a separate CPT loop within the author archive loop?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #138772
    Pete

    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 🙂

    #138815
    Tom
    Lead Developer
    Lead Developer

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.