12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Aug 19, 2019

FacetWP and Pagination on Archives in Oxygen

Sridhar Katakam

Updated on 13 Dec 2023

Pagination output by a WordPress theme or plugin will not usually work i.e., get automatically updated after the results are filtered using FacetWP.

The solution is to replace the default pagination with FacetWP’s and add facetwp-template class to the parent of the looping posts i.e., Easy Posts or Repeater.

This tutorial provides the steps to fix this pagination issue on archive pages like category archives in Oxygen when using FacetWP.

Step 1

Your archive pages should generally speaking, respect the number of posts per page setting in WordPress (at Settings > Reading).

If for whatever reason, that is not working use pre_get_posts filter to set your desired number of posts per page on your archives by following this example.

Step 2

Create a Pager type of facet.

Note: “Repeater Pagination” is just a label. If you are using Easy Posts, you could name it “Easy Posts Pagination”.

Save and click on Re-index.

Step 3

Edit your archive Template in Oxygen editor.

Add an Easy Posts or Repeater component inside a Section.

Leave the query as default.

In Easy Posts’ Template CSS add

%%EPID%% .oxy-easy-posts-pages {
  display: none;
}

If using a Repeater, add this in a custom stylesheet:

.facetwp-template .oxy-repeater-pages-wrap {
  display: none;
}

Below Easy Posts or Repeater, add a Shortcode component having your Pager shortcode.

Ex.:

[facetwp facet="repeater_pagination"]

Step 4

Select the Easy Posts or Repeater component and add this class: facetwp-template

References

https://facetwp.com/help-center/listing-templates/wp-archive-page/#how-it-works

https://facetwp.com/documentation/shortcodes/

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right