I would advise using the built-in ACF functions for this. Elliot has provided a full toolbox for you and documentation for all field types:
<?php
// Conditional statement (Single Value)
if(get_field('page_layout') == "col_1")
{
//...
}
//Conditional statement (Multiple Values)
if( in_array( 'col_1', get_field('page_layout') ) )
{
//...
}
?>
Check out the ACF documentation:
http://www.advancedcustomfields.com/resources/select/
Related Posts:
- Array sorting by custom field date
- Filtering multiple custom fields with WP REST API 2
- WP REST API: Order posts by meta value (acf)?
- meta_query with array as value
- Check for the existence of custom field
- pre_get_posts filter using numeric meta_query comparison (from dates)
- Using meta_query and custom fields within pre_get_posts to return posts within a numerical range
- Comparing arrays with meta_query in pre_get_posts
- ACF repeater field with meta_query
- Can an array be used as a meta_query value?
- sort by date in Advanced Custom Field
- Get specific repeater row (via advanced custom fields) based on Meta Query with Wildcards [closed]
- Using pre_get_posts for meta value of LIKE comparison on ACF repeater sub field
- Display post in order of ACF checkbox?
- How to write PHP array to render JSON-LD Markup for Job Postings, with ACF
- Changing a specific value inside a complex repeater/flexible content field (ACF)
- Filter posts by advanced custom field
- Get posts with multiple meta values
- Trying to select 1 item from an array
- ACF checkbox array is returning numbers, not labels [closed]
- Query by radio button ACF
- WP get_posts meta_query using ACF repeater field
- get_posts filter meta_query using ACF Checkbox
- Multiple orderby date arguments
- Display posts every specific day
- How to use germ_terms() with meta_query for ACF Taxonomy field?
- Help using an array in ‘exclude’ key of another array
- Convert number to date format within an array
- Time sort with meta_key using UNIX timestamp failing due to date differences
- update_post_meta and update_field ony working when saving the post
- Matching Serialized Arrays with meta_query
- Get the label from ACF checkbox [closed]
- How to update a custom post title from a front-end form using ACF fields?
- Query pages for use of a flexible content layout
- List of posts by day of the week
- ACF if / else checkbox [closed]
- ACF Plugin – Random Gallery Image with wp_get_attachment_image()
- Sorting custom admin column by value
- Update post meta value as date difference between two fields
- Get Current Post ID in functions php, meta query filter
- get all posts in custom post type by ACF field value
- Wrap Gutenberg blocks both frontend/backend (PHP approach with ACF)
- change value of fields created with advanced custom fields in the front
- Advanced Custom Fields Plugin: Get file URL into Parent
- html element to separate php variable strings – ACF datepicker
- Grouping posts by a custom meta value
- If/Else Statement for Advanced Custom Fields
- Search and replace not working for ACF Images
- How Do I Use a ACF Custom Field To Add A Slider ID?
- ACF relationship fields ‘The results could not be loaded’
- get_users with array as meta_value
- change order of images attached to post
- Hidden field in acf
- How do I ensure the social icons appear on all pages? [closed]
- Strip comma from last element in concatenated JSON string
- How to get file upload value in front-end to put in ACF image field
- Sorting the portfolio by an ACF? [closed]
- How to change the background color of my header dynamically based on a Custom Posts types color value?
- TinyMCE’s “Clear Formatting” button doesn’t remove lists and headings
- Prevent other hooks from firing after wp_update_post() outside of editor
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- Can I use WP blocks in a template?
- Set post publish date by custom field
- Use Acf Repeater data as options for a different acf custom select field
- ACF get group fields from current post taxonomy
- Explore custom posts (CPT UI & ACF) database from WP UI
- Trouble with serialized metadata
- Transitioning Laravel App into WordPress (Portfolio Website)
- ACF – Get ID of relationship field in flexible content
- Creating permissions rules with ACF repeater field
- ACF meta_key and meta_value break loop
- WordPress meta query with meta serialized data array value
- Reading Content in an Array as it relates to a meta_query
- How to pass get images in homepage also in portfolio page?
- Srcset incorrect with Owl Carousel and ACF?
- ACF order relationship by date
- meta_query for user ID in array
- How to create an ACF shortcode with Repeater Field in WordPress functions.php?
- Generate custom sized images from certain images in media library
- Relationship field problem: Uninitialized string offset: 0 in
- Page returning ID from array, how to return the correct values for post in acf wordpress
- How to use an ACF taxonomy relationship field as part of the URL structure for a custom post type?
- wp_insert_post with advanced custum fields repeater
- Only list category if it has a custom field image
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Sort Posts with custom meta key by default which is currently set as optional
- Advanced custom fields – If/ while field problem
- How not to strip leading zero in advanced custom fields
- update_field() with repeater fields issue [closed]
- Advanced Custom Fields Image Crop
- Display ACF field only if value is greater than 0
- How to use ACF repeater? [closed]
- Updating post object via ACF breaks front-end
- I want to place a post before all others from an ACF boleen field
- How to indicate a parent child category relationship when bulk importing
- Use value from meta key array for use in WP_Query
- Filtering custom post admin listing page elements based on acf user field
- Parsing value from Lottie JSON file
- How do I add an ACF shortcode to a non-ACF page?
- Convert acf/gutenberg markup to html