What I would suggest is to create a custom WP_Query
. What you would do is something like this (modified from ACF documentation):
<?php
$posts = get_posts( array(
'meta_query' => array(
array(
'key' => 'in_row_view',
'value' => '1',
)
)
) );
if( $posts ) {
foreach( $posts as $post ) {
// Do something.
}
}
So, in your code, you will not use the base while(have_posts())
loop but a loop iterating the post (the foreach
in my example).
Related Posts:
- Batch Extract Date from post title and put into ACF custom field
- WordPress – display relationship between blog posts and custom posts
- Adding specific custom fields (images) to post excerpt
- Styling first post using Advanced Custom Fields
- How to automatically update ACF field value every year?
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Which post does a taxonomy term belongs to?
- List custom taxonomy specific to one custom post type
- Post image in WordPress not appearing on home page
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Meta query for custom post type ignored in main query
- Changing custom type name hides the posts
- Display Ad on Specific Categories
- How to add a post slug to a url?
- Add custom ID to CPT posts only create not update
- Hiding posts by other users and non-logged in
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Bulk Update Custom Fields for Custom Post Types
- ACF Field on CPT Slug
- Matching Chapters to a Custom posts [closed]
- Update Post Meta for a logged in user
- Add custom field to Posts and sort by it
- Add custom post type settings to wordress default posts
- WP_Query order by custom field, then randomly order some of results
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Get related posts of child term of custom post type
- Two Custom Post Types Many to Many Relationship
- Problem with displaying posts in the CPT category
- Troubles with acf/save_post and WP_Query
- Query custom post type with ACF Date
- JS innerhtml changing style when using AJAX
- custom post type WYSIWG removes paragraphs when displayed
- Stuck in Order by more then one
- Custom Post Type + ACF and performance [closed]
- Show titles, date of all posts on single category page
- Meta Query Not Returning Output Despite Having Matching Values
- Side effects of Script and Iframe in post
- ACF From & To Date Validations
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to change the post type a theme shows by default?
- How to render a custom post type template with custom fields using shortcode
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- Set a checkmark in a category based on a URL-parameter
- CPT archive admin menu label
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Several post types on WP Query by tag and taxonomy
- No Permission to add new Page, Post or CPT with Admin role
- Update postmeta Parent when post_status child change
- custom post type category count shortcode
- Portfolio Page for Classic Posts
- Order Custom Post Type by Custom Field Value
- Add post location with mile radius allowing search
- Get the category from custom post type
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- Set up post page like JAMA articles
- Retrieve custom field from Contact Form 7 [closed]
- Custom Post Slug same as Parents Category Slug
- Shortcode not working with post counter
- Query Custom Post Type Taxonomy term with multiple parameters
- Changing default ‘posts’ parameters with register_post_type_args
- Admin Column does not populate with data
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- How to query WordPress posts bycustom field with a max characters’ length
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- The loop seems stuck to a single (now deleted) post
- Prioritize posts in query by meta keys?
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Allow users to create posts without logging in?
- How to update post meta on uploaded image from a custom form?
- How to get all tags of a custom post type by id
- How to group posts and get a mixed posts and groups view?
- How to define which register_post_status goes to which register_post_type?
- Load Next Posts With AJAX not working with custom post type
- Limit the post for differents custom post type in the same wp_query
- Custom Post Types vs. Advanced Custom Fields (with Repeater Field add-on)
- Multiple Frontend Filters Using Advanced Custom Fields
- Integrate Custom Post Type Events into Calendar
- Specific routing for CPT
- 2 Different Custom Post Types in Submenu
- How to assign classes to all elements?
- Order post by date with ACF
- Displaying custom field according to date
- How can I show 1 featured post in a styled element, and the next few below differently styled
- Some posts from custom post type to subdomains
- How to set the seo title tag on a page by page basis?
- WebP Fallback for Inline Background Image in Style Attribute
- Adavnced custom fields relationship query plus query inside
- Query based on custom fields start and end date
- How can i create an custom post template for an specific post category? [closed]
- How to sort posts in a custom post type by title in ascending order by default?
- Redirect to another page using contact form 7? [closed]
- How To Import CPT With Only Few TEXT ACF Fields From Front End?
- Advanced custom field boolean value in custom post type
- WP the_posts() on single-cars.php get category link
- Conditional for a Single Post That Belongs to a Category?
- $post not working working in AJAX plugin with custom post type
- Permalink misbehaving in Custom Post Types