Learn how to add a filter and sort to a view.
We’ll cover the following:
- Only display article content types.
- Sort the view by latest articles.
Let’s now add in a filter so that it’ll only display article content types. Currently, it is displaying all content on the site, which is articles and basic pages. Scroll up to filter criteria and click on add, and search for content type, and then click on add and configure filter criteria. From the operator section, make sure you select is one of, and then from content types, select article, then click on apply. So now the view will only display published articles. And if we scroll down, we should only see published articles here. Now let’s sort this list so that the most recent article is up at the top. To do that, scroll back up and click on add in the sort criteria section and search for authored on, and make sure you select authored on from the content category. And from order, select sort descending and leave granularity set to second and click on apply.