admin管理员组

文章数量:1424963

I have a couple of custom pages in WordPress. How do I tell my page to get me only the posts I assign (if I could assign) to that page? Is there a way to tell posts whose page they are for?

I have a couple of custom pages in WordPress. How do I tell my page to get me only the posts I assign (if I could assign) to that page? Is there a way to tell posts whose page they are for?

Share Improve this question edited Jun 2, 2019 at 17:36 butlerblog 5,1313 gold badges28 silver badges44 bronze badges asked Jun 2, 2019 at 15:34 EliEli 112 bronze badges 2
  • 1 I don't have the full picture, but the correct way to do this probably wouldn't be with pages. Instead you should assign the post to categories, and then provide custom templates for those categories. – Jacob Peattie Commented Jun 2, 2019 at 16:03
  • @butlerblog This type of edition should not be made from the Low Quality Posts queue. – nmr Commented Jun 3, 2019 at 8:19
Add a comment  | 

1 Answer 1

Reset to default 0

If you write code...

Step 1. Find and edit every post you want to assign to a page and give them all either: 1) The same Category, 2) The same Tag or 3) The same post metadata

Step 2. On that page's template or in a custom block or widget write a WP_Query that gets the posts (by tag, category or post meta) and displays them on the page in the format you want.

There are other solutions and even more if you are not a developer but that is the solution I think is the easiest if you know how to write code.

本文标签: How to select what posts goes into which custom page template