Something like this should achieve your goal. You may need to remove the is_main_query()
check depending on where you want this to show up though.
add_filter('pre_get_posts', 'projects_are_posts');
function projects_are_posts($query) {
if (is_admin() || !is_main_query() ) {
return $query;
}
$types = $query->get('post_type');
if (!is_array($types)) {
$types = array($types);
}
if (in_array('post', $types) && !in_array('projects', $types)) {
array_push($types, 'projects');
$query->set('post_type', $types);
}
}
Related Posts:
- How do you use a CPT as the default home page?
- Displaying custom post type on front page
- custom post type index page
- Display all Posts and only certain Custom Post Types with meta fields
- Notice: Undefined index: suppress_filters
- Custom post type is showing custom home page, not archive page
- custom home page and custom index page?
- Static page determines as home, but it is not
- Custom Post Type within the Loop on Homepage (Page Template)
- show all custom posts types in home page
- Set a hard-coded page-template (post-type-archive) as home/front-page of my wordpress blog?
- Function to limit number of custom post types on homepage – TwentyTen
- Setting a homepage – doesn’t seem to work
- custom post creation on front page – on submit a search is done
- Display another page / custom post type as home page
- WordPress custom post type as homepage with homepage url
- Custom Post Type Single Page and Archive Page redirects to Home Page
- Custom post pagination not working
- Custom Homepage As Single Page or Custom Post Type?
- How to make post page unique and show it on home page?
- Custom Post Types and 404 Pages
- How to filter homepage posts by popularity? [closed]
- How to get ‘Products’ on home page?
- How do I set the default admin sort order for a custom post type to a custom column?
- Delete all posts of a custom post type—efficiently
- Custom Post Types not showing on Custom Taxonomy archive page
- is_singular() not working if called via callback function of admin-ajax.php
- Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts
- Search everything (posts, pages, tags, cpt, meta)
- Reslug a Custom Post Type
- Removing CPT slug from URL results in 404 error for archive page
- front end radio custom taxonomy with custom post type
- Search Post Title Only [duplicate]
- How to add meta boxes(repeater fields) from WordPress back end?
- Displaying Meta Box Image
- Admin List Dynamic Heading
- Beginner question: Accessing functions.php through admin web interface in order to import custom post types?
- How can i list custom post type categories?
- Query Custom Post by Category
- Custom post query by taxonomy
- Create second custom 404 page for selected post type
- Custom post type routing with hierarchy
- Role Capabilities: Add New Ones?
- Sub-Sub-Blogs — creating and importing content into a custom sub-type
- Custom post type with slug for plural (archive) and for single
- Custom post type archive not regarding ‘posts_per_page’ => -1
- Add category in post type dynamically
- Shortcode insertion in tab
- Group custom posts by custom taxonomy names
- Use regular category with custom post types
- Change Featured Image / Thumbnail CMS Description
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- How to convert custom post type based list to a dropdown list?
- can’t see custom post content filtered under “mine” filter in admin panel
- Custom template Page 2 not working
- Why is get_pages() returning a boolean?
- Settings API – save multiple tabs at once
- Exclude current post for custom post type
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- Which file/template is in charge of taxonomies for custom post types?
- Sort custom post type by most current date picker
- Using menu_position to add two entries between Dashboard and Posts
- custom permalink for post only not custom post types
- How to manage selected post-formats in custom post type
- Remove default WYSIWYG editor without removing custom fields editors
- File sharing platform for user contributions? [closed]
- List All Custom Post Types Posts in Nav Menu Dynamically
- Save CTP post meta different values each day without overwriting previous values
- Changing CPT slug and taxonomy already registered in parent theme
- Show post count number assigned to custom taxonomy
- Update ACF fields on a frontend form? [closed]
- Page-CPT.php redirects to archive or single.php
- Sanitaizing Select Optin For Custom Post Type Metabox in WP
- Printing errors during save custom post type
- How to setup a permalink structure for a custom post type
- Creating on-page options for Custom Post Type
- Check when the post type changes, and display content
- Loop and add Specific Categories and Products Images
- Is possible register two archive pages for single custom post type?
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- Custom Post Type with Different Sets of Post Content?
- Add a class to a div if custom post type has specific terms?
- Custom post type paging return home page
- Where is get_post_meta value located?
- 2 modal windows with ACF content on Archive page
- Custom post type single page uses the right template in preview mode but shows a different template after being posted
- Custom Post Type – Display all, wrap in groups of 3
- Showing Custom Post Type with his templates on a custom page template
- Custom post edit page permalink links to edit page rather than the post
- WordPress loop, show only one post per custom field
- Getting list of Categories for Custom Post Types
- get children from current variable (taxonomy) via shortcode
- Show Templates in Custom Post Type Editor
- Ideal top-level slug methods
- How can I make a custom post type that loops pages in a new dashboard page, each single page is a new dashboard page (all within the back-end)?
- Two blogs on same WP website
- Pagination not working for archive
- Save post_parent in a custom post type
- Show custom category archive as front page and remove taxonomy slug from urls
- Meta_query question