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?
- Why have my custom post type searches stopped working after changing URLs / updating WordPress?
- Highlighting current item of custom post types’ sub pages, listed by wp_list_pages
- paginate function in archive for custom-post-type
- Does WordPress support an unlimited or large number of custom post types?
- Page to display an archive of taxonomies
- WP Query group/order by category name
- exclude custom post type by meta key in wp_query
- WP query by custom post type slug/name
- How to make custom posts to behave like taxonomy?
- Should I use custom post types for a front page video feature (vimeo)?
- How do I provide a “show all posts” link in a paginated term archive?
- Custom Post Types and Categories?
- Custom post type ‘orderby’ => ‘meta_value’ not working
- Parent & Child Taxonomy slugs in custom post permalink
- Loading custom post thumbnail into stream
- WordPress custom loop filter by meta_key and value with serialize data
- the_content() not outputting anything (Advanced Custom Fields)
- Change custom post type slug from plugin options
- Custom Post Type With Categories
- How to use has_archive but disable feed per post type?
- Custom Taxonomy back-end customizations
- WordPress CMS Inquiry
- Custom rewrite url category
- Why is this query not working? (Standard posts + custom post type)
- Edit the author of custom post type
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- browse by category and tags?
- Search by tag name and category
- How to add multiple images to a custom post type without plugin [closed]
- get_the_title() is returning results from previous loop
- Moving meta boxes in admin
- Can we create a custom post template for a specific page template
- Post-thumbnail only for specific post-types?
- How to display custom post type tags?
- Featured image size in column
- Page Template Dropdown For Custom Post Types
- Get_the_terms restrict output
- Can I query posts by taxonomy conditionally based on post type?
- How to get dropdown instance value in WordPress custom Widget
- Include custom post type custom taxonomies in Categories widget
- Break up posts per page in two sections
- WordPress custom post categories and subcategories on category.php
- post_content is stripping HTML when adding a new post? [closed]
- Can’t replace the default sidebar with a custom sidebar on Custom Post Type in Genesis
- Dynamic category name in query post
- Two queries – one with checkbox ticked, one without – comparing meta_query
- Ignores post_type when no results
- custom post archive URL is wrong
- Can I decide what categories show on my posts page?
- How do I call the custom Post Type name and permanent link to my php file?
- Mandatory field in Custom post
- Link custom post type to users membership
- In child theme, add CPT to custom taxonomy registered in parent theme
- How to display posts with plugin (advanced custom fields) field groups?
- WordPress – display relationship between blog posts and custom posts
- Load info from customposttype into template page
- Multiple Loops In Tabs Only Displaying First Loop
- WP_Query to display number of custom post type filtered (order by) taxonomy
- Sort loop by custom field from different post type
- How to create groups like that in buddypress?
- Custom meta box data not saving
- Include template if a post is a single product
- Allow viewing the edit screen for a post type, but not make/save/publish/update changes
- Render custom taxonomy query as single template
- Custom meta-box for all custom post types
- Retrieve a specific category of posts when using a custom post type
- General question about Parent and Child Post type relationships
- WordPress Load more posts by ajax not working
- What’s the best way to show custom post types? With page template it’s not perfect!
- Multiple while loops not functioning [closed]
- Listing all custom post types using a specific term on the said term’s template page, in groups
- How to write an if statement which reads: ‘if is this custom post type or a child of it do the following’?
- taxonomies or categories w/custom post
- Require Custom Taxonomy for Custom Type
- Post count for particular term
- Url rewrite with custom post type and taxonomy
- Custom Post Types Permalink