WordPress: Twenty Twenty-two theme & Search bar


Overview

As you are adding posts to your WordPress blog you make it harder and harder for the visitors to find individual or related posts.

As usual with WordPress there is more than one solution to this problem. For one, WordPress itself offers an out-of-the-box search block that can be added to the page. But there are also other solutions offered by various plugins.

WordPress Search Block

The configuration of the WordPress “Search” widget can be quite different depending on the theme you are using. Here we look into the problem of getting the WordPress Search Block working in the case of Twenty Twenty-Two theme.

Navigate to [Appearance\Themes\Editor (beta)]:

The Search Block can be placed in different positions on the page, here we place it in the header. Click on the WordPress icon on the top left to see the themes Editor options and then click on the [Template Parts] menu:

Click on the Header template which is used in your page (your page might use more than one header):

Switch to list view by clicking on the corresponding icon in the top menu bar:

In the items tree on the left select the item where you want to have the Search Block placed (you might try different options to figure out which is the best place for you to put the Search Block in). Then click on the [+] icon on the top left:

Type “search” in the search field that appears and then select the “Search” widget on the results below it:

Click on the “Search” widget. This will add the widget to the place you selected before in the items tree (see above), in our example in the Header:

You can repeat these steps several times and figure out the best place for you to place the Search widget.

Click on the [Save] button.

Now if you check your page, you should see the new Search box in the header and should be able to filter your posts:

Related topics

WordPress: Customizing the TwentyTwentyTwo theme