I think you should be using the WordPress loop
instead of a foreach, since you’re using WP_Query.
<?php if( $header_images->have_posts() ) { while( $header_images->have_posts() ) { $header_images->the_post(); ?>
<div class="header-image">
<?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?>
</div>
<?php } } ?>
Related Posts:
- How to completely disable a taxonomy archive on the frontend?
- Why is get_post_format() for “Standard” returns empty
- Custom post types and child theme
- Password-protect a custom rss feed
- White screen error for a custom theme
- How to override parent theme function through the child theme [closed]
- Single Page WordPress CSS and JS links
- How to use custom fields to enable sticky posts on custom post types?
- Hide Meta Boxes for Non-Admins
- I am trying to output portfolio items with a picture. This code doesn’t seem to be working. What am I doing wrong?
- Pre_get_posts filter overwrites all search functionality
- Is it possible to place custom post type files inside a folder in theme directory?
- Custom template with CPT doesn’t display on frontend
- Create a wordpress test-system as a clone from productive system
- Get term name and term parent into custom post type permalink
- What is the best practice for displaying my plugin content in themes?
- Migrating a taxonomy’s tags to the native category
- Adding custom image sizes and post types to a plugin or to a theme?
- Want to be able to sign up subscribers as authors
- How do I set a custom page template for a custom post type?
- Unable to set featured image
- Running a song lyrics site on WordPress
- Using page slug in wp_query
- Specify a particular page to list all custom types
- uploading problem of wordpress theme
- How to have permalink like domain.com/term/postname?
- Page Template Dropdown For Custom Post Types
- Custom post types problem
- why post_class() function apply css classes to all other files?
- Template Hierarchy for custom post type pages
- Should Custom post types and fields be in the theme files or in a custom plugin packed into the theme?
- Custom post type is using the index.php template
- Create a simple Testimonial page
- One Site. One Theme. Multiple Stylesheets without plugins?
- Custom Post Type – Portfolio no longer works
- Methods for development wordpress themes [closed]
- Render a Post or Page using the correct file
- Can I assign a theme to a custom post type?
- Custom Post Type – Main page for certain posts
- Invalid content when I try to import custom post type from the old template wordpress
- Query when is one or several values
- DIVI Theme customizer changes not applied on existing pages and designs are not shown on the front
- I can not call the categories of custom post type
- Change Background Color For CPT Template
- WordPress add taxonomies/terms list as a menu in archive page
- Adding CPT changes entire layout of my site except for the archive of that CPT
- getting a blank login page :( any way I can fix this without having to do a clean install?
- How to get main div html to print a list of posts inside?
- erase post excerpt limitation [×]
- How to get $post object available inside functions.php to localize script?
- Query custom post type and showing its content
- Problems with a custom meta_box
- Create custom post order (with custom post type meta)
- Query by post type or category
- Change position of Post Formats box?
- How to manage wordpress knowledge base/wiki/posts collections
- How to get ‘Products’ on home page?
- how to display custom taxonomies in front page
- REQUIRED: The theme uses the register_post_type() function, which is plugin-territory
- How can I produce multiple webpages with a different output based on one entry/Page/custom Page?
- Multiple Custom Metabox Help
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Column sorting with emtpy meta values
- Add custom column to custom post type overview in backend
- Create sub single pages
- If on term-page -> get the current term?
- Should I change these content meta types before building complex archive page?
- Using a Custom Field instead of original title field but only for Custom Post Type
- Edit/Customize the Single Page of a Genesis Sample Child Theme
- How to initialize PODS?
- wordpress custom post type remove duplicate menu item
- How to create A-Z index listing for custom post types?
- Custom post type search with slug in URL
- Query Custom posts of same taxonomy as the post itself
- Showing posts from different categories and from custom post type
- Editing a list of several fields
- Rewrites/query for multiple hierarchical custom post types
- Custom Post Type has_archive
- Taxonomy/Custom post type structure suggestion on a movie site
- Get Tags by specific Category of Custom Post Type
- Custom Field values not Showing in Edit Page of Custom Post Type
- Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?
- widget_posts_args not using the number of posts in widget
- Get current user id
- Add data to post edit page, when post is published
- How can deregister scripts for a certain custom post type?
- Custom posts – tag pagination
- Getting custom post types to properly display alphabetically
- Custom Post Type Specific Post Template
- Front end create custom post types
- Pagination links for custom post type shows correct number of links, but links result in Page not found
- How to prefix custom post type URL with custom post taxonomy term?
- How do i truncate content length to 500 words?
- WP_query sort by taxonomy
- Breadcrumb that shows multiple custom taxonomies
- “No item found” empty list after adding a new Custom Post Type
- Custom Taxonomy Query by Taxonomny not working
- Custom post type as page template
- Parent and child custom post types without options on parent
- Trying to create a custom column for a custom post type