Divi: the easiest WordPress theme to use
Divi: The best WordPress theme of all time!
With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]
Do you want to know how to allow users to filter WordPress posts and pages?
Recently, one of our users asked us how to add filters to his WordPress website allowing users to filter posts by category, tag, post types, etc…
In this tutorial, we will show you how to allow users to filter publications and pages on WordPress.
If you have never installed WordPress, discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog
But back to why we are here.
Why let users filter articles and pages on WordPress?
By default, WordPress comes with categories and labels - tags - as a way to sort content into topics and for your users to find them easily.
However, users can only view one category, tag, or archive page at a time and that only shows one type of post.
What if you want users to be able to filter content in more than one category or more than one tag? How about letting users see posts, pages, and custom post types at the same time?
This type of filtering can be particularly useful when you have a lot of content and want users to be able to filter them according to their preferences.
That said, let's examine how to allow users to filter articles and pages on WordPress.
Allow users to easily filter articles and pages
After activation, the plugin will add a new menu item titled " Search And Filter »On your dashboard menu. Clicking on it will take you to the plugin usage page with detailed documentation on how to use the plugin.
The "Search & Filter" plugin comes with a shortcode that accepts different parameters to display the filter options. You can use this shortcode in a publication, a page or in a text widget.
[Searchandfilter fields = "search, category, post_tag"]
You can also use the shortcode as a PHP tag in a file of your theme as follows:
This will display filtering options with search fields, category categories, and labels.
Easily create your website with Elementor
Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]
By default, the plugin accepts search fields, for taxonomies, the type of publication and the date of publication.
Let's take a look at another example. This time we're going to include categories, tags, post types, and date fields.
You will have to use a shortcode like this:
[Searchandfilter fields = "search, category, post_tag, post_types, post_date"]
Here's how it will look:
Now instead of using the drop down selection field, you can also use the checkboxes and add labels for each field. To do this, you will need to add two more parameters to the shortcode.
If you use a separate page to display your articles, you can add this shortcode to the page.
[Searchandfilter headings = "Select categories:" types = "checkbox" fields = "category"]
If you use multiple fields, types, and titles, you must ensure that the elements are in the same order for each parameter.
Let's see another example. This time, we add categories, labels, and publication type fields with different topics and form field types.
[Searchandfilter headings = "Post type, Category, Tag" types = "checkbox, select, select" fields = "post_types, category, post_tag"]
Here's how it will appear on your website:
Please refer to the plugin documentation page for more options for using the shortcode.
You can also use these shortcodes inside a text widget.
That's all for this tutorial, I hope it will help you add search and filter for any kind of content.
Discover also some premium WordPress plugins
You can use other WordPress plugins to give a modern look and optimize the grip of your blog or website.
We offer you here some premium WordPress plugins that will help you do that.
1. WordPress Automatic Plugin
WordPress Automatic Plugin is a premium plugin that will help you target and find content from various sources such as: Amazon, Walmart, YouTube, Vimeo and DailyMotion, Feeds, eBay auctions, Flickr, Instagram, Pinterest, Reddits, Twitter, Facebook , Craigslist, iTunes, Envato, and SoundCloud.
When it comes to articles, the plugin can extract categories and tags, as well as specific parts of original articles, and convert parts of articles to full post. It has options to remove all links before publishing, to define the status of the publication to be written or published, to exclude words and phrases, to translate the content before posting, and to automatically define the content. picture to the front.
You will be able to adjust the settings to ignore messages without pictures, messages that are not in English, and duplicate titles. It supports multisite and automatically adds custom fields to messages. These fields can contain details like title, author, content, image, price, and rating.
2. Ultimate Learning Pro
As the name suggests, Ultimate Learning Pro is a WordPress content protection plugin for educational WordPress websites. It's a fantastic Learning Management System (LMS) that will get you up and running in no time.
In short, it is an all-in-one solution to create an online learning program where students can join and learn about different topics. Instructors and teachers will also be able to join in and share information with knowledge-hungry users.
To consult also: 6 WordPress plugins to define custom avatars on your blog
It has more features than: Ultimate Learning Pro sports and Ultimate Learning Pro. Whether it's different payment services, course reviews, wishlists, pushover notifications, custom currencies, or scheduled course posting.
Ultimate Learning Pro works seamlessly with other e-commerce and member area management platforms, such as WooCommerce, Easy Digital Downloads et Stripe to name a few. For a small fee, you can now build your own e-learning system and take your project to new heights.
Also with more 500.000 active installations and an overall rating of 4,9 stars, UpDraftPlus is another popular migration plugin for WordPress websites. Like Duplicator, this plugin is already part of our recommendations for quite some time. The free version is available in the WordPress.org plugins directory, but there is a The premium version available for between $ 70 and 145 $.
UpDraftPlus, while free, is a powerful plugin that supports default cloud storage, automatic scheduled backups, and the latter splits compressed files into multiple parts when the website is very large. Creating a backup is all about choosing which files and directories you want to include in it. You can then restore a backup to an existing website; replace themes, plugins, add files and all with just one click.
Read also : 7 WordPress plugins to combat spam
The premium version offers many more features, with additional storage locations, database encryption, compatibility with multisite, premium customer support and multiple operating licenses.
The Premium version also offers a tool that allows you to clone a website in one click and a migration feature that allows you to move a website.
Find out about other recommended resources to help you build and manage your website.
- How to add a parallax effect on any WordPress theme
- How to add a WooCommerce store on Facebook
- Writing: How to write an irresistible article introduction
That is all ! We hope this article helps you allow users to filter posts and pages. Do not hesitate to share with your friends on your favorite social networks.
And if you have any suggestions or remarks, leave them in our section Comments.