More than categories, you have custom taxonomy, it’s easy to add custom taxonomy to post edit screen and retrieve these custom taxomnomies according to any logic with a custom WP_Query.
An example:
function continent_init() {
// create a new taxonomy
register_taxonomy(
'continent',
'post',
array(
'label' => __( 'Continent' ),
'rewrite' => array( 'slug' => 'continent' )
)
);
}
add_action( 'init', 'continent_init' );
The query to retrieve it (a [pre_get_posts][3]
will be better than this)
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'continent',
'field' => 'slug',
'terms' => 'europe'
)
)
);
$query = new WP_Query( $args );
Hope it helps
Related Posts:
- How to have a static category/author page?
- in_category() works in single.php but not in page.php?
- custom query for both category and pages using global $wpdb;
- Custom Portfolio Page
- How can I make a category function as a page?
- Getting page/category content to show up in my custom page template
- How to check if I’m on the last page of posts?
- Gutenberg editor add a custom category as wrapper for custom blocks
- Decreasing the Memory Consumption of a WordPress Site?
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- How can I select a primary category?
- how to use a different domain/subdomain for authors/catagories on single site?
- Deleting default category in wordpress
- How to list child categories in custom category template?
- Create a full width responsive header image per page
- Remove child products from woocommerce category page [closed]
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Block multiple categories from Blog
- Listing all posts from current category on page
- Create single.php for specific category by category id
- Show posts of one category only with Custom Taxonomy on single.php
- I use same slug name for category and page
- Save metabox checkboxes values to custom content type
- Remove “Parent” Selection When Adding/Editing Categories?
- Show posts of category in a page
- Order Taxonomy Term by date created
- Show pages and articles in category search result
- How to create taxonomy values for pages and list them in wp-admin
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- Viewing category pages without the word ‘category’ in URL
- Categories vs. Page Site Organization
- How to view WordPress’ default category IDs?
- Multiple Category Search
- How do I add a function on a specific post category?
- Show posts on a page based on a category and tag(s)
- Category-slug.php not being used
- How would I go about adding custom header images per category?
- Hard coded main navigation
- Display posts separated by Category in Author’s page
- posts_nav_link(); picks up index.php instead of category.php as template
- Multiple URL’s based on category for one post
- category permalinks
- Filtering *out* a taxonomy from the admin post list
- How to “group” (categorize) the Pages together?
- Custom category URL rewriting
- How to build a simple nav system of custom post type categories and its posts?
- How to insert category list into post creation page, and retrieve chosen categories?
- Is it possible to remove from default category widget?
- How to customize my category pages
- How do I display something on a particular category page?
- How to create a subcategory to a PAGE on WP?
- Get the ID of 10 Latest Pages stored in a WordPress Category
- How to show 5 posts from specific category on related page?
- How to put page numbers with the next/previous on a post/category list?
- How can I display tags as categories?
- Different CSS class by category
- “Virtual category page” based on a custom field filter
- Group search results by category
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Getting the Most Recent Posts from Multiple Categories
- Showing Categories for Page Edit – without plugin
- How to let the user create a selection of categories via the backend
- Using categories with pages
- Add posts of a certain category to a page
- Custom css per category and per single post belong in each category
- How to hide widget from certain category
- How to add icon over specific thumb
- Problem with Custom Post Type Categories
- Posts of specific category on page and excluded from index.htm
- SQL query to get posts from multiple categories but not in a category
- wp_delete_term or wp_delete_category?
- How to add meta description, keywords, custom title to a category template
- separate posts to have (kind of) 2 blogs?
- display specific category when website loads
- remove url from categories
- Page category filter in admin dashboard
- Template category.php with page (no posts)
- Showing the category hierarchy as clicked in WordPress, with image and desc
- problem with filter of custom portfolio categories
- Deleted categories still listed until additional page refresh
- Default URL for category dropdown select option
- Adding a category view to a page
- Category For Pages In WordPress
- Inserting categories as a hierarchical terms from frontend form
- How to add a post with new Taxonomy without assigning to default category?
- If it is a top level category show children otherwise show sibling categories
- Using wp_list_pages to create 2 lists of pages and include and exclude some of them depending on their category
- Pages with posts filtered by category
- Own Custom Tags/Category page ( posts)
- How to create default categories in new installs?
- Pages, Categories, and working with someone else’s code
- Page redirecting to category (IE only)
- Return selected categories only in custom page meta box?
- Need help with category page customization meeting certain condition
- Show custom menu in category and its posts
- not empty categories don’t show in menu [closed]
- How can I show page per category in wordpress? (Yes, category by page!)
- How to prevent page re-sizing for mobile browsers [closed]