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
- creat filter with wp_query
- Specific query for custom post type
- page menu entry for custom post type
- How to display custom WP menus?
- 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?
- What’s the equivalent of Hide From Menus on MODX on WordPress?
- Is there a way to establish parent/child relationship in WP menu links exclusively?
- WP_Query orderby and tax_query
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Displaying Posts from Custom Post Types
- Different Ways to Query Custom Post Types?
- A page that shows a list of a specific custom post type
- Single custom post type’s menu ancestor/parent is Posts archive page
- How to organise this data within WordPress
- menu link to custom post_type?
- Review site custom post type structure
- Custom post type posts don’t show in archive widget
- Custom Post Types in the WordPress Navigation Menu
- Showing specific post in order of array wp_query
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Number of posts in the archive
- Ordering Submenu Pages in WP 3.1
- Including link to custom post type in ‘wp_list_pages’ function
- Query of custom post types only shows first post
- Custom query for custom post_type
- Adding custom field values to wp_list_pages
- Query multiple taxonomies with pre get posts
- How to query 2 custom post types that need to share a slug?
- Which Template Page Should I Use?
- How can i automatically add CPT single pages as sub menu items
- Query Custom Post Types with checkboxes
- How can I use archive-{post_type}.php theme template?
- WP_Query() with custom post type and taxonomy — get all terms?
- Custom Post Type Link added to menu won’t show in frontend
- show all custom posts types in home page
- List of child custom post types lists all custom post types
- How To Display A List Of CPT Posts In A Meta Box On Menus Page?
- Query custom post type based on post id and custom field value
- Listing custom post types on archive page with array
- Get custom post type categories to show up in menus
- 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
- WordPress menu with custom taxonomy
- Prevent custom post type from showing up in custom menus
- Can I query posts by taxonomy conditionally based on post type?
- How to conditionally add Custom Post Type to Front Page
- Graphql: Unable to query (where:{author}) for custom post type
- Query not work for current taxonomy
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Returning a custom content types with meta values
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- Custom Query: If One Post Object Field Value Is The Same As Another
- Break up posts per page in two sections
- Custom Post Type not showing in main loop
- Custom Post Type setup
- new WP_query > displays posts only once instead of running through full array
- Pagination on search results page
- Querying a custom post type, but not show duplicates
- Custom Post Type – Portfolio no longer works
- Shortcode to return single custom post based on post taxonomy
- is_main_query() never called on WP 4.4
- Hide text if query has no posts
- How do I get the index for a custom post?
- Getting custom post types to properly display alphabetically
- Create query for both custom post type and category
- Filtering custom posts by custom fields (ACF) [closed]
- Function to limit number of custom post types on homepage – TwentyTen
- How to programmatically add elements in a custom menu
- Custom taxonomy query showing more than 4 posts
- Custom types, taxonomies and query optimization
- Query Custom Post by taxonomy multiple categories
- Query custom posts from custom taxonomy
- Custom Post type showing up in loop, regular posts are not showing up
- All in one calendar custom post type query doesnt work as expected
- Custom Posttype and menu classes
- highlight parent page menu item when in custom post type
- Custom post type post in custom menu
- Custom post type posts wont show in wp_nav_menu()
- Changing WordPress sort order for returned child pages
- Add custom post type to query
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Home page is getting current-menu-item even if it’s not home
- Placing Admin Post Metaboxes in Tabs
- Menu for taxonomies and posts belongs to taxonomy
- How to divide Subcategories into pages of parent category wordpress
- How can I put content before my custom post type default pages?
- Update query based on CPT / Post Type, show all sorted by date
- Query filter by value in meta_value array
- Change search query in wordpress custom post type
- WP Query from two Custom Post type fields as statement
- WP Query: If field X is empty, show posts based on field Y
- Check that a slug is present in the get_terms request
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?