You can use Advanced Custom Fields to add two fields where the admin can select a category. On your index page, you then check the two fields using get_field for which category you want to display.
The field can return a WP taxonomy object, or just the category ID (which I have used). In your index, you can then get the posts:
$category_id_1 = get_field('category_1'));
$category_id_2 = get_field('category_2'));
$container_1_posts = get_posts(array(
'posts_per_page' => 5,
'cat' => $category_id_1,
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
));
$container_2_posts = get_posts(array(
'posts_per_page' => 5,
'cat' => $category_id_2,
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
));
Related Posts:
- Categories box not showing on post edit pages
- Custom Theme Want To Remove One Category From All Displays
- Get Posts Under Custom Taxonomy
- How to add category to: ‘wp-admin/post-new.php’?
- Use category base slug in posts’ permalink
- Setting Custom Sort Order of Posts within a Category
- Display the latest post from a category in a page
- How to show list of posts by author and category?
- Exclude drafts in all() view of edit.php
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- List latest posts in WP-Admin
- How to control which category will be picked for the slug of a post?
- get_the_term_list by hierarchy order
- Add default content to post (for specific category)
- Query only Posts from Both of Two Category?
- display sub categories assoccited with each post in a category archive page
- Display most recent post in category instead of archive?
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- get_post_type_archive_link(‘post’) returns current category archive
- Embed WordPress Admin in an iframe
- Can’t publish, edit or delete posts since Gutenberg update
- How to place HTML below the title of the (custom) post overview
- Get user’s most published categories
- Conditional that checks if a current category has any subcategory with posts
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Exclude posts from featuring
- Diplay comment date on WP_Post_Comments_List_Table
- Change default Posts page
- Articles are text-only in any “Category” instead of HTML
- How To Remove Certain category Posts From the Blog Page
- Add icon/badge next to posttitle of specific category
- I am unable to publish/update post
- Get current category id from post page wordpress
- Saving category to a post, before publishing the post
- Assign category to new post via URL
- Stop users posting into category while still seeing contents of the category
- Category Page Template not Showing Posts
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- WordPress custom Query for Posts in Category display posts multiple times
- Categories list into registration form
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Using ajax on editing a category edit page?
- Showing categories and subcategories with posts
- Change default category when I publish a post
- Loop doesn’t exclude the specified category in home page
- Post Image not displaying in category view
- How do I include the category next to the title of a post?
- Parent category / child category posts
- Unable to differentiate between two categories under custom post type on single.php
- Exclude post category in a blog page
- Are post, page and category IDs unique to each other?
- Static pages not working
- WP_Query of Category Not Showing First Post
- How to make posts being uncategorized
- How to display a single(current) post from a category
- displaying the categories post
- What’s a theme that properly handles previews of different types of posts?
- Some blog posts containing source code fail to save draft or publish
- How to add content above footer in posts from specific category
- WordPress – When visiting a `single post/ single.php` my category menu item link becomes active
- Edit post & page option does not display on latest wordpress
- Custom Fields – How to get the list of a specific active widget each time it rendered
- My page shows some other content in WP
- How to view a post from the wordpress admin screen
- How to Create another Page Category like the “Post” and “Pages”
- How to show WP admin edit page within template page/post?
- How to create a button to filter posts (list) by meta value
- Many buttons not functioning in WordPress dashboard (as admin)
- Is there a way to save different data when USER interacts with the same POST?
- How to display particular categorie’s post which associated to specific user?
- Display Specific Categories posts on the home page
- show only one category and filter by tag
- Code to display random ordered posts in Categories across pages [duplicate]
- AJAX load more posts not using correct category and repeating the same few posts
- Category posts show on local install, they do not show on live server
- How can I exclude only a specific sub category post from category display?
- how to print total number of posts filtered by category?
- How to filter out post from a category not its subcategory in wordpress dashboard
- Add category information beneath post?
- Admin is showing all posts on page 1
- How can I display a specific number of post in a category via a url
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- Newly created category does not show category
- How to pass multiple checkbox values to wordpress query?
- Sort post by category using HTML Select tag
- Show a Category Specific Info Box
- Display the first post’s comments of category in comments.php template
- How to filter categories of a post
- Error establishing a database connection
- List posts related to category on a div [closed]
- how to show all post with its contents
- wordpress show category link instead of post link [closed]
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- Only show posts belonging to multiple cateogries at same time
- Wrap posts from a category in HTML
- Add News Feed to bespoke website, only to one page on whole site
- How to display my categories in a list (to a post, not the sidebar)?
- How to make category for word post_content
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- I cannot see the pagination in /wp-admin posts page