Multiple Posts Set Up

Using the plugin it’s possible to display multiple sets of posts on the same page and paginate them independently. This requires a specific set up in the template files of your theme.

Multiple sets of posts are created by using more than one WP_Query in your template. Let’s setup our first query. In the example below we’re selecting all posts from the category news; but your query will be different.

The next step is to display the results of the query. This is a standard WordPress Loop except we reference our specific query that we saved into the $query variable.

Finally we add pagination links that are specific to our custom query. The paginate_links function is used for this.

Finally all code should be wrapped in a containing div with a unique class name. When displaying multiple sets of posts all code including the pagination should have the same parent. The complete code should be as follows.

For the next set of posts on the page we need to update our paged variable and run a different WP_Query. Throughout the code below any references to paged1 have been changed to paged2. Also, there is a newly named containing div. This process should be repeated for each set of posts and the paged variable incremented by one each time.

Plugin Admin Settings

The settings for each set of posts should then be added to the plugin wrapper settings in the WordPress admin. For the above examples we would need two groups of settings using the following selectors.

Posts Selector: .posts-selector-multiple-1
Post Selector: .post
Navigation Selector: .navigation
Next Selector: .navigation a.next

Posts Selector: .posts-selector-multiple-2
Post Selector: .post
Navigation Selector: .navigation
Next Selector: .navigation a.next

For a full demo of this feature take look at the Multiple Posts page.