This is because by default the paramater for post_type
is post
.
To include all the post type add the below to you arguements
$args = array( 'numberposts' => 5, 'post_type' => 'any' );
The above will include all the post_types including pages and custom post types and if you would to include specific post types use an array like
$args = array( 'numberposts' => 5, 'post_type' => array( 'post', 'movie', 'book' ) );
For more details check the codex
Related Posts:
- Remove Actions/Filters added via Anonymous Functions
- Programatically add options to “add new” custom field dropdown
- Excluding iPad from wp_is_mobile
- paginate_links() don’t properly work in search.php?
- How to influence the information displayed on widget inside wp-admin
- How can I get $id variable in widget’s form function?
- Use ‘add_theme_support’ instead of ‘add_custom_image_header’ In WordPress 3.4
- Replacing select2 in admin backend for all selects
- difference between add_object_page and add_menu_page
- How to hook into the quick edit action?
- Override a class function to include a custom template
- How to auto-update child posts whenever the parent post is updated?
- I created a child theme and it doesn’t work for some of the css files
- Make WordPress size and name images for Retina.js
- the_post_thumbnail fallback using hooks
- How to detect first visit of a user?
- How to programmatically set a menu to be the Primary Menu?
- Pinterest Integration Using functions.php
- Changing itemprop from logo to image on custom logo?
- Override woocommerce wc-class function
- Trying to inject twitter metadata into using wp_head action in functions.php – get_the_excerpt() returns null
- How to hide, and not to remove the attributes metabox?
- how to edit functions.php in a child theme
- Only display link to author social media when it exists [closed]
- Get current page_id before loop, in functions.php
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- Change Rating range in Link Manager
- Create single.php for specific tag by tag id or name
- function to erase swear words
- str_replace function in theme
- Function call via ajax – can’t figure it out?
- Using $themename Variables
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- WordPress Menuing Question :focus
- Wp_schedule_event functions.php
- How to auto refresh when user change postcode
- Add sequential number to a Gravityforms form
- wp-comment author- url +, email filter hook
- What WordPress function to use to get meta value by using meta keys?
- how can I just add to parent theme function(s) instead of redeclaring whole the function
- Can’t generate thumbnail images
- How to create an onclick event on an image in a post?
- Why does re-using this function not work? [closed]
- using jQuery on only one page
- How to display retweet count and likes in the meta above the excerpt
- Setting a default text for excerpts of a particular category
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- Possible to hook into Media Library preview File column and use a custom image?
- Programmatically add Yoast meta description after post save
- Woocommerce checkout field
- Warning: preg_match(): No ending delimiter ‘^’ found in
- How to display the_archive_title() and the_archive_description() – “weird” interaction
- Remove Jetpack infinite-wrap
- Create a Woocommerce product widget with category filter
- Remove attachment page for audio media type only
- Where to store credentials used in a function? [duplicate]
- “options.php” not found
- Both the require and add_template_part function are not including the file
- Function that prevents users from uploading photos more photos
- Function to echo (or display?) wordpress tags in the head section
- is_home() not working in functions.php file
- Filepath to Chosen for “Home Page” option – Which function?
- Conditional function for excluding first image from content, not working
- Check if a different page has any attached images
- Disable autosave with `function.php` for custom post wordpress?
- WordPress 6.0 upgrade caused my custom function to stop working
- Different image using srcset function
- Save Meta when custom Taxonomy Saves
- Pagination not working – FrontPage
- Enable accessibility mode in widget as default
- Fetch ids of live posts only (not posts with other statuses) and change status with a button in candidate dashboard
- Customise the WordPress gallery html layout
- Change class woocommerce on function.php
- What is the earliest Hook a Script can use?
- Google Analytics – add script to functions.php
- Adding new Category does not refresh the backoffice
- How do I make a custom “Read More Blogs” button for my blog page
- CSS disabled after getting rid of emoji
- Load scripts into an AJAX div
- True parameter but jquery register in header and not in the footer with wp_register_script
- Why is style.css not loading through the functions.php
- previous_post_link inside of a function?
- Search and Replace Script Loader in Head Only Works in Footer
- Child Theme functions.php has no effect
- Setting a cookie in functions.php and it gets deleted when working on an other function
- custom post with loading script per single post
- wp_upload_bits – define (sub)folder / (sub)directory before filename?
- Apply height and width for the_content() inside youtube video tag
- Check if excerpt is empty at loop-portfolio
- Add gallery id to rel attribe of wp_get_attachment_link
- How to add a class name to the ancestor of a post?
- update_post_meta after form is submited
- Make a table out of meta box
- is_user_logged_in() isn’t working
- Retrive post by tags PHP code
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Different ads on every website on multisite environment
- WordPress Custom wp mail template return full template
- How to get variable from other function inside class function using add_action for Ajax call