Use get_posts()
or filter 'pre_get_posts'
on the front page.
Sample code for get_posts()
:
$my_post_array = get_posts(
array (
'post_type' => array ( 'post', 'custom_type' )
)
);
foreach ( $my_post_array as $post )
{
// do something awesome …
}
There are also parameters for a custom order by meta fields and so on. A filter on 'pre_get_posts'
can do the same and more. It is just not as easy to read.
Related Posts:
- Extend walker class with custom post types [closed]
- automatically placing custom post types singles into submenu of main nav menu
- Use custom walker to add taxonomy terms to main nav menu
- Navigation won’t update to show full path to single post
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Get the ID of the latest post
- Adding an Archive of Posts to the Navigation Menu in WordPress 3.0
- Adding custom post type archives to a WordPress menu
- How to add custom post type archive page links to nav menu?
- Sort custom post type list table by display name of a user id stored as post meta value
- Query menu_order custom post types
- Custom Post Type Menus
- Highlighting current item of custom post types’ sub pages, listed by wp_list_pages
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Term Checklist Walker – Disable Parent Categories
- Querying Posts by Taxonomy From Alternate Network Site
- Query posts between two dates (custom meta keys) CMB2
- Adding posts of custom type into the main feed
- Custom Select Query with Custom Post Types
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- Highlight parent menu item when child post
- wordpress custom post type remove duplicate menu item
- adding .current* tags to custom post types and taxonomies
- How to get custom post type menu_name?
- WP_Query search posts by custom post type and custom taxonomy
- Calculating Bayesian average for custom post type
- how to get post slug from url in wordpress
- How to filter custom taxonomy categories on archive?
- Modifying date filter on admin page for custom post type to link to custom field
- How to debug a blank page?
- query posts and custom post type with meta key
- Fake mark a menu item as current_page_item/active in WordPress
- WordPress Orderby Numeric Value Not Working
- Add/Remove current_page_parent class
- Query string parameters from custom fields, inconsistent results
- Add post_type to index.php
- Order By Post Type ThenBy Taxonomy
- Custom query to filter posts that have current post as a taxonomy [closed]
- Update menu when saving settings
- custom post type not showing in menu
- How to modify archive query with pre_get_posts to append CPTs?
- convert custom query to wp_query
- Custom Taxonomy Navigation, with current menu items for children?
- Making certain categories of CPT not publicly queryable
- Display posts from Custom Post Type in category page on front-end
- Use menus with anchors
- Get parse_query filter to return slug instead of id
- Custom Post Type Nav to Subpage
- Meta query for custom post type ignored in main query
- Specific query for custom post type
- page menu entry for custom post type
- Display post content with respect to its title?
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- WP_Query orderby and tax_query
- Different Ways to Query Custom Post Types?
- Review site custom post type structure
- Number of posts in the archive
- Ordering Submenu Pages in WP 3.1
- Query custom post type based on post id and custom field value
- How can I create an automatic drop down menu with my tags?
- show current item in custom menu, when inside a custom post type
- Make (custom) post type accessible only by custom query
- Prevent custom post type from showing up in custom menus
- Graphql: Unable to query (where:{author}) for custom post type
- Custom Post Type – Portfolio no longer works
- Getting custom post types to properly display alphabetically
- All in one calendar custom post type query doesnt work as expected
- Placing Admin Post Metaboxes in Tabs
- Query filter by value in meta_value array
- Change search query in wordpress custom post type
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Does this archive template part look like its making too many calls to the db?
- build child and anchestor three from post parent
- Meta query and compare “!=” not working as expected
- wordpress get menu id by custom post_type?
- How select query is generated in a Custom Post Type?
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- Linking posts together with Advanced Custom Fields “both ways”
- Hierarchical Custom Post Type Walker?
- Show first posts with custom field not empty and order all by title
- Use the page picker from wordpress menu creation page
- Is it possible to add query parameters on the archive page?
- current_menu_parent for custom post type and custom url
- Calling the first & last post by category in custom post type
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Custom Taxonomy Showing in WP Menu
- Query child posts on parents single.php?
- WordPress can only query up to 766
- CPT Archive with parent page
- Pagination not working with custom loop
- Setting a Master Menu on a Custom Post Type
- Show custom posts with a specific “custom TAXONOMY slug” on startpage
- Allow admin to determine the order of queries?
- and custom post_types to custom menu
- Code in custom widget queries all posts, when it should only query the current post
- How to add post type in masonry posts elementory widget
- How to make a single Menu Item call another Mega Menu for Custom Post Types and Custom Taxonomies?
- Get Posts ordered by a date custom meta field
- Load posts via AJAX without draft status