This is how you display posts from a specific category when you select the menu at the top.
Setting Categories for Your Posts
1) Check the list of currently published posts in the All Posts menu on the left side of the WordPress administrator page.
You can see that the categories of all posts are set to Uncategorized.

2) Go to the Categories menu on the left.

3) Enter the category name and slug and add. Slug refers to the English identifier used in the URL address of the category. For example, if you set the Slug of a category to restaraunt, the URL address of this category is as follows.
https://yourdomain.com/category/restaraunt

4) Add a new category in the same way.


5) Go to the quick edit of the post.

6) Select and check the category of the post and update it.

7) Set up categories for all posts in the same way.

Adding a Category Archive Template
8) In the block editor of your site, go to Templates menu. Click Add Template at the top right to add a new template.

9) Select the type of template you want to add. Select Category Archives to use category archives.

10) Select Category to use categories for specific items.

11) Select the category in which the template will be used.

12) To apply a pattern, select a pattern from chose a pattern or select Close.

13)If you select a pattern, You will see the category template with that pattern applied in the block editor. Click save in the upper right corner to save (go to step 19).

14)If you did not select a pattern, Add a new block.

15) You will see the various types of blocks you can add in Blocks.

16) Search for and add Query Loop block. The Query Loop block is a block that automatically loads and displays various content lists such as posts, pages, and categories.

17) Select choose in the added query loop block.

18) Select the pattern to use in the query loop block and save it.

19) You can check the newly added template in Templates.

Linking the category page in the navigation menu
20) Select edit in Navigation to move to navigation editing.

21) Select the menu in the top navigation and enter the page link address. In the example, the Slug of the restaraunt category is set to restaraunt, so the page link URL address is as follows.
https://yourdomain.com/category/restaraunt

22) Select the menu in the top navigation in the site view. You can move to the restaraunt category page, but you can see that the image is not displayed properly.

Setting the featured image of a post
Featured Image is the representative image displayed above the post title or the top of the page. If the site template includes a featured image block, if the featured image of the post or page is not set, it will be displayed as blank.
23) You can check that the featured image block exists inside the query loop block.

24) Go to edit the post in the Posts menu of the WordPress administrator page (edit)

25) You can check that the featured image is not set for the post. Go to set featured image.

26) Upload the image to be set as the featured image, check the preview, and click set featured image

27)Click save to save your post.

28) When you select the menu in the site view, you will be taken to the category page and the image will be displayed normally.


Leave a Reply