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?
- Frontpage overriding my posts
- Forms and WordPress Nonce
- Invalid Taxonomy
- List custom taxonomy as navigation – taxonomy pages with all it’s posts?
- How can I set a meta value that will then affect other post meta values?
- How to select a template for a custom post type?
- Show Custom Message in WordPress Admin
- get_posts seems to be skipping the last Post
- Saving data for different custom posts
- Dynamically insert an article at the top of a taxonomy archive – or?
- Getting a custom post’s custom field based on another custom post’s custom field select
- Why do I have to press the “Update” button twice to save my meta box values?
- Count custom post type based on two meta data
- TinyMCE Buttons on Certain Post Type
- Merge page with custom post type
- Need help deciding on a taxonomy
- Inserting custom fields into single.php
- Alphabetically sort a taxonomy.php template by post title
- Inefficient Query Confusion
- How can I include active content in a custom post type?
- Create a custom post type for a photo post
- Display an icon based on post type
- Linking to Post Types from wp-admin
- Shared terms between taxonomies
- Creating a website with EVENT post type and PAGES as subpages of those EVENTs
- Fix permission error for deleting custom post from front-end?
- Create a list of recent Custom Post Types posts
- Post will not load via ajax
- Displayling list of Custom Post Type Posts
- Archiving custom post content?
- List of Categories for Custom Post Type
- Plugin or method of allowing user to rearrange custom post types with drag and drop?
- How can I remove filters from custom post types?
- WordPress menu with custom taxonomy
- Problems with custom taxonomies
- Querying multiple values from a single key
- Not able to export large no. of posts in csv
- How does: /index.php?post_type=event&event-date=2011-07-25 work? What if it doesn’t work?
- attach CPT data to a taxonomy
- Attaching a Custom Taxonomy to Posts?
- Building Forums with Custom Post Types
- Full RSS feeds for Custom Post Types
- archive as a page, so that it can be added in the wp_menu_nav
- custom post type problem
- Can’t add text in front of shortcode
- Custom Permalinks for Custom Post Types
- Creating separate feeds for custom post types
- Displaying Custom Posts
- Displaying multiple post types on home page
- Category Icon on custom post type
- Prevent custom post type from showing up in custom menus
- How to do admin CRUD & Pagination
- looping though custom post types and only return results in a given taxonomy
- display custom taxonomies limited to custom post type?
- Allow front end users to add data to a custom post type
- custom fields cannt be seen with version 3.1
- Displaying custom post types as a gallery
- Get_the_terms restrict output
- Populate a custom field dropdown with post titles by author
- Can I query posts by taxonomy conditionally based on post type?
- Shortcode leaves no space for other elements?
- Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?
- Conflict between wp_list_pages and get_posts – list pages not displaying
- User-submitted reviews of different custom post types
- How to make a pulldown menu display custom meta terms in a theme?
- After creating custom post type, URL to custom posts are invalid
- Custom post type index (maybe using get_template_part)
- Custom post type menu
- Listing all slugs?
- How can I merge this function(s) that inserts terms to a custom taxonomy with this other that adds a custom taxonomy filter?
- What would be a proper name for a custom post type created for static content?
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- Custom fields not saving in newest WordPress 3.0.1
- How can I display a drop-down select of Post Names
- Which file/template is in charge of taxonomies for custom post types?
- Implementing Pillar Posts; Long Posts yet with Some Page-Like Handling?
- get_post_types – exclude multiple post types by name