FacetWP is an excellent plugin for setting up filtering capabilities for entries in WordPress.
Here are FacetWP's benefits over using something like Isotope:
- supports pagination out of the box. Entries being filtered need not all be present on a single page
- supports automatic narrowing down of filters i.e., as items get filtered by one criterion, options in other filters automatically change to be relevant to the result set.
- fast and easy
This tutorial provides the steps to display a grid of Portfolio CPT entries on its archive page with Portfolio Categories and Portfolio Tags filters at the top. Needless to say, this can be applied for any post type and any associated taxonomies.
Step 1
Install and activate Portfolio Post Type and FacetWP plugins.
Step 2
Add your Portfolio entries while making sure to set featured images. In this example, we are using images sized 714 x 428.
Step 3
Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
How does FacetWP work/play with WP-Types and Views?
I’m having a horrible time trying to get Isotope or MixItUp working with anything Toolset-related
In this particular tutorial, the portfolio CPT was created by Portfolio Post Type plugin. It does not matter which plugin/method is used for the creation of CPT. It could be Portfolio Post Type plugin or Pods or Types or something else.
I stopped using Views long time ago and may not be able to answer your question correctly. Whether or not you have Views installed should not matter/affect the output/working of this tutorial, so long as it (Views) is not applied to the page in question (which is CPT archive, in this case).
Hi Sridhar,
In functions.php, when doing:
add_action( ‘pre_get_posts’, ‘change_archive_display_parameters’ );
function change_archive_display_parameters( $query ) {
if ( $query->is_post_type_archive( array( ‘mycpt’ ) ) ) {
$query->set( ‘posts_per_page’, ‘5’ );
}
}
Pagination works fine showing the right posts in every page, but filters fail. On the first page, they show the categories/tags/taxonomies of the entries that belong to that first page, not all the entries for all the archive. On the second, you can only choose the cats/tags/tax of the entries of that page, etc.
On another note, I’m trying to build also a page with a custom query. I know how to remove the Genesis loop and add my own query, no problem with that. And I’ve followed every possible method of adding FacetWP. I’ve tried all the official methods given by Matt Gibbs and various other tricks, like making FacetWP think that’s the main query, etc. No matter what, FacetWP doesn’t connect with the query, although I know it works.
Could you make a tutorial on that?
Thanks very much.
Sorry, I forgot to mention that I tried to obtain pagination as per your other tutorial on FacetWP. Without that pre_get_posts() code, it works perfectly (as does the Genesis pagination) and filters work fine, but with that modification of the main query, WP Facet pagination doesn’t even appear. As said above, Genesis pagination works but filters don’t.
Hi. Thanks for this tutorial, but it does not work yet for me. I got this error:
Error: Call to undefined function genesis() in archive-portfolio.php on line 109
Could you please, help me with this issue?
Hi. Are you using a Genesis child theme on your site? If so, is the parent Genesis theme present in the themes directory? Can you provide the URL of your site?