Good news! I think you’re making things harder for yourself than they need to be. If I understand your question, you’re looking for rewind_posts(). The always useful Digging Into WordPress has a nice summary of it.
Because both tasks involve looping through the same query, you don’t need get_posts() at all.
Instead, you’ll want to use the aforementioned rewind_posts() something like this:
<?php if( have_posts() ) : ?>
<!-- Your list of posts -->
<ul>
<?php while ( have_posts() ) : the_post(); ?>
<li><a href="https://wordpress.stackexchange.com/questions/51342/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php rewind_posts(); // second <del>verse</del> query, same as the first ?>
<?php while( have_posts() ) : the_post(); ?>
<!-- your "blog-style" stuff -->
<?php endwhile; endif; ?>
Related Posts:
- How to check if I’m on the last page of posts?
- Display list of Sub-Categories and the posts they contain, within one main Category
- Loop with Dynamic Categories
- Remove child products from woocommerce category page [closed]
- Categories list loop – add separator every year
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Display the last post by each category?
- How to insert category list into post creation page, and retrieve chosen categories?
- Categories list loop – add separator every 3 categories [closed]
- new WP_Query all post in a category inside the loop
- Getting the Most Recent Posts from Multiple Categories
- Template category.php with page (no posts)
- Order Categories by Character Count
- How to loop custom post_type from (a) specific category(ies)?
- How can I display tags as categories?
- Do not show sub categories in the loop on archive-product.php
- issue with if/elseif in_array inside foreach loop display only one post
- Hide specific category from wp_list_categories
- How to get an array with all categories and corresponding names?
- Link To Child Category For A Post
- How do I add a separator to my list of terms with get_category
- How to display the parent category if only the child category has been chosen
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- Category tags with comma’s
- How to show a list of only categories (exclude subcategories)
- Category list with postcount
- Display posts of certain categories to specific user roles
- Trying to create a Categorised Index (archive?) to use as my Home Page
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- “Virtual category page” based on a custom field filter
- Group search results by category
- Simple way to style posts of a single category differently in the loop and in single
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Showing Categories for Page Edit – without plugin
- Need to echo category id in multi-dimensional array
- Getting Category Children
- Display subcategories in dropdown
- Display category title and three latest post inside the category
- More efficient way to list posts by category [duplicate]
- Using categories with pages
- Add posts of a certain category to a page
- Have posts that belong to multiple categories, exclude some categories from homepage
- Category nicename inside loop in wordpress
- I need to exclude from a query a category and a few custom taxonomies
- Show multiple categories in query using redux framework variable
- Get the ID of the current post’s child category
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- multiple values in an array for category__and does not work with WP_Query
- custom query for both category and pages using global $wpdb;
- Limit Loop to One Category
- Display post thumbnail for specific category outside the loop
- List post only under the category, exclude child category content
- Posts of specific category on page and excluded from index.htm
- Filter Category Loop Dynamically
- Editing Loop So It Targets Specific Tags?
- posts going to 2 pages/categories only show up in 1
- the_category() doesn’t working in wp_query loop
- Conditional category query breaking?
- Problem: retrieving parent category’s first post
- Custom Portfolio Page
- How to get posts using category slug in ClassiPress?
- Category sticky latest
- Posts made to category don’t show up (do show up on frontpage)
- Exclude posts without category from loop
- Getting the posts list visualised in categories tree
- Category name for all posts getting assigned to a single random post
- How to use category slug with a regular page
- Category post count is not correct
- Display all categories but only if they have posts in them that have a specific tag assigned
- display specific category when website loads
- Include last post date in get_categories loop
- remove url from categories
- Show the number of the post
- Return all Tags and Categories in Separate List
- How to redirect to category page if page does not exists?
- Page category filter in admin dashboard
- How can I order all subcategories alphabetical independent of the parent categories?
- How to get specific (grand parent) category of current post?
- Custom Loop with certain number of one category
- how tho change number of posts in loop from specific categories
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- Showing the category hierarchy as clicked in WordPress, with image and desc
- error in specific category loop
- loop in single.php of the same category
- How to distinguish pages created by woocommerce?
- get taxonomy list in a page in the wordpress
- How to create a category loop on my blog (ACF Plugin)
- Please tell how to stop the category from showing up on posts
- Hide a category/posts from the homepage in wp
- How can I make a category function as a page?
- Loop by category and meta_key
- displaying one category on one page
- Assign a class to first element in category in loop
- Displaying Category in sidebar post widget but not in the loop on home
- Need help to structure our a complex hierarchy
- Adding a category view to a page
- Cant get unique_array() work on get_the_category() foreach loop