What about using the UNION? Just an example:
(SELECT * FROM $wpdb->posts (with JOIN and WHERE as needed))
UNION
(SELECT * FROM $wpdb->posts (with WHERE to select pages))
GROUP BY/ORDER BY
The select(s) must be in parenthesis to use an order by for the whole union result.
As a second option, you can use a plugin to enable the categories and tags on pages, I used it many times to classify even the pages inside a category.
The call to be fired on WordPress “init” hook is:
register_taxonomy_for_object_type('category', 'page');
and while editing the page you’ll have the classical category chooser like the one of regular posts.
Related Posts:
- How to have a static category/author page?
- in_category() works in single.php but not in page.php?
- Display posts separated by Category in Author’s page
- SQL query to get posts from multiple categories but not in a category
- Custom Portfolio Page
- How can I make a category function as a page?
- Need help to structure our a complex hierarchy
- Getting page/category content to show up in my custom page template
- display certain category on custom template page
- Different banner for different section
- Custom category URL rewriting
- Putting a Category of posts under a Page
- How to build a simple nav system of custom post type categories and its posts?
- category pagination got broken suddenly
- How can you change the permalink for pages?
- How to query categories with Advanced Custom Fields?
- Should I use “Categories ” or “Pages” for a WordPress Static Site (A non blog site)?
- Where and when does WordPress invoke routes
- Category.php loads first before page.php?
- How to insert category list into post creation page, and retrieve chosen categories?
- Display thumbnails for certain category posts
- Multiple Category Query
- Keyword search in multiple 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?
- And/Or Category Query
- Automatically redirect a page to a category that share the same slug
- How to create a subcategory to a PAGE on WP?
- Get the ID of 10 Latest Pages stored in a WordPress Category
- How to make the ‘delete’ button inactive on some categories?
- How to show 5 posts from specific category on related page?
- Two columns in homepage each with one category
- Exclude category from query
- How do I get category and page ID’s?
- How to put page numbers with the next/previous on a post/category list?
- Overriding default calendar to show posts from a category
- How do I attach a page to a category similar to how we attach media to a post?
- How can I display tags as categories?
- Multiple selection for wordpress widget
- Different CSS class by category
- Trying to create a Categorised Index (archive?) to use as my Home Page
- how to nest specific category thumbnails inside different containers
- Wrong category nice name is displayed on archive page
- “Virtual category page” based on a custom field filter
- function query_posts disabling current_page_menu class
- 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
- Theme for subcategories
- Using categories with pages
- Add posts of a certain category to a page
- Add code to header based on category for specific posts?
- Custom css per category and per single post belong in each category
- How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category
- Using in ‘category_name’ in ‘$query->set();’?
- How to hide widget from certain category
- I would like to feature a tip on the homepage
- How to add icon over specific thumb
- Get categories of queried posts
- Query from multiple category (and)
- How to display posts from specific category using get_option function?
- Problem with Custom Post Type Categories
- List post only under the category, exclude child category content
- How to display only one category in a custom post type?
- Posts of specific category on page and excluded from index.htm
- wp_delete_term or wp_delete_category?
- Select posts that match multiple category names, must match all categories listed
- Conditional category query breaking?
- Last x Posted Categories?
- I need advice on how to structure the categories according to the layout i have
- show only sub categories if available?
- How to add meta description, keywords, custom title to a category template
- separate posts to have (kind of) 2 blogs?
- How to filter post from categories only if the posts appears in one of them, not the other?
- Category name for all posts getting assigned to a single random post
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- How to use category slug with a regular page
- display specific category when website loads
- remove url from categories
- List of post categories only associated to another custom taxonomy
- How to redirect to category page if page does not exists?
- Page category filter in admin dashboard
- how tho change number of posts in loop from specific categories
- Category Page Displaying all Pages
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- 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
- Get category from slug list
- Category custom template is not showing correct posts
- Search Replace Database ONLY for posts of certain category?
- displaying one category on one page
- Default URL for category dropdown select option
- Filter custom taxonomy posts via AJAX