February 10, 2021

A View lets you load posts from the database and display them as a fancy list. You can apply filters to refine results or a custom search to allow users to easily find posts based on different parameters.

Watch the following video to quickly learn how to create a View.

A View is a list of items, typically posts, that meet specific criteria. When creating a new View, you can select how it will list content. You can choose between different output styles:

  • Grid
  • Table
  • Unordered list
  • Ordered list
  • Unformatted output

You can also add a custom search to your View so visitors can filter the posts and find exactly the ones they are looking for. Your custom search can include inputs for custom fields and taxonomy, to filter the search results.

For example, you can create a View that displays recipes based on search parameters. In our example, we have set two criteria. One is a relationship with another post type (Kind of food), and the other one is a custom number field (preparation time).

Results of a custom search
Results of a custom search

View Loop

A View retrieves a list of posts from the database and then goes over them one by one. For each item (post) in the View Loop, it outputs the post fields that you select.

Finally, you can place any content before and after the View loop.

View loop elements
View loop elements

Displaying posts on a map

If your custom posts contain the Address custom field, you can display View results as markers on a map.

View results on a map
View results on a map