The reason its messing up is because its adding the custom post type everywhere. You want to limit it to just the main loop of the main page. Justin Tadlock wrote an article on how to do that here. Here is what your code should look like:
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', array( 'post', 'page', 'projects' ) );
return $query;
}
This limits it to just the main loop of the home page.
Related Posts:
- Query all posts where a meta key does not exist
- How to Add Custom Taxonomy To Woocommerce Plugin
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- Render a different post/template from within the template_include action?
- Can you have two CPTs with the same permalink structure?
- Remove wpautop from all posts/pages except my custom post type
- Custom templates for posts like for pages: page-{id} vs single-{id}
- Alphabetical sorting of custom post type – one letter per page
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- Comment moderation on custom post types
- How to set default status to custom post type
- Post Via Email to a Custom Post Type
- how to only have one custom post type post?
- Hierarchical or Non-hierarchical Custom Post Type in Real World Example
- How can I show some description in the “All Posts” view of a custom post type in Dashboard?
- Display all Posts and only certain Custom Post Types with meta fields
- How to add custom fields to admin UI and REST API response?
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- adding checkbox to meta
- how can i get posts from custom post type particular taxonomy category
- Add CPT as subpage under custom page
- Conditionally custom post type url rewrite
- List custom post types in metabox
- Multiple ACF Repeaters within a Custom Post Type
- How to create a separate Loop for custom post types?
- Root slug of taxonomy returning 404
- Show only posts from one category on custom post type archive page
- WordPress Custom Post Type Repeated 404 Errors
- Custom post query with multiple fields with number values. Totalisation needed
- Possibilities for the edit.php admin panel? [closed]
- Sort entries by date mixing two post types
- unable to show custom post type featured image
- What code should I use to display children of a custom post?
- wp_dropdown_pages doesn’t work with post_type argument
- How can i create an custom post template for an specific post category? [closed]
- comment_notification_text filter for custom post type
- Search one custom post type ONLY, disable “all posts”
- Modify previous and next post links to current Authors Other posts
- Querying two taxonomies with tax_query not woking
- Enable Custom Fields For Custom Post Type When CPT Created Using Plugin
- Custom post type, global categories — what’s the template name?
- Should I create Custom Page Types?
- Excerpt function for any content
- WPDB for post count on post
- Custom Meta fields Update hook?
- Invalid Taxonomy
- Cannot get custom post
- How to add section above header for custom post types
- How to handle this specific case of custom post type?
- Display metaboxes if checkbox ir marked
- Change link for “add new” buttons on custom post type
- Urls in Custom Post Type work for Terms but not for its Taxonomies
- Custom Endpoint For Custom Post Type from Child Theme
- WP_Query: Posts within category OR custom post type
- How to add href=”” custom post type?
- Add filter to Admin list for all custom post types by their custom taxonomies
- Single.php for Custom Post Type > Taxonomy > Term
- add_query_arg() for custom post type on all visible links
- Custom post types templates
- prevent sub categories to show up
- Saving metabox keys and storing values as array
- Redirecting search to specific templates with $_GET[“post_type”]
- Custom post type filter is being applied to all of my posts
- Custom Post Type Archive Page showing as 404
- Cannot include custom post item within a menu
- Custom taxonomy terms hierarchical navigation
- How to sort by multiple values in a nested WP_Query
- Apply a custom Template to a Custom Post Type from within a plugin
- How to create a Child & Siblings menu for a custom post type?
- Dynamically Adding Posts of Post Type to A List
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Automatic Set Category For A Custom Post Type
- If thumbnail image else post title
- How to build Custom Post Nav Menu inside of the Loop
- Different Configuration for the_excerpt()
- Loading a stylesheet on a specific page [duplicate]
- Display related post content and custom field content
- Create an administation subpage containing posts in a certain category
- SQL LIKE in WP_Query
- How do I block/redirect ‘?post_type=cpt_name’ urls?
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Simple renaming my custom post type set with a plugin doesn’t work?
- can’t see categories in appearance-menu-categories
- Different read-more link for each custom post type [closed]
- How to retrieve the permalink for a specific (custom) term?
- Meta-Box to add multiple items one at a time and on publish save all
- Values inside a custom field to determine which category posts to display
- CPT, Custom User Role and problem with user manager
- Display results from two Custom Post Types in page template
- Create a page selector using taxonomies
- Custom post type as a category, for another custom post type
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Create page using same slug as custom post type
- Code to show related posts (custom post type and custom taxonomy/category) is messing with other code
- register_term_meta not working
- show posts under custom post type with same autj
- Change post structure
- Permalinks for Custom Post Types and Taxonomies
- Group search results by post type, but having a unique heading for each section?