If it’s created with ACF, then the way to call the field is like this:
$can_download = get_field('enable_downloads',$postid);
so your code should look like:
<?php
global $wp_query;
$postid = $wp_query->post->ID;
$can_download = get_field('enable_downloads',$postid);
if ($can_download == 'yes') { ?>
<?php } elseif ($can_download == 'no') { ?>
<?php } elseif ($can_download == 'other') { ?>
<?php } else { ?>
<?php } ?>
Related Posts:
- Can wp_query return posts meta in a single request?
- Getting attachments by meta value
- meta_query where value is equal to given value
- WordPress altering my custom query, How to fix it?
- Group WP_Query by meta_key date
- exclude posts with a specific custom field and value
- How to make Meta Query case sensitive?
- Display custom field meta outside loop, site wide
- Fetch Record based on meta key dates
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- Order WP_Query results by meta key value in custom query
- How do i create a custom post query when the meta value is an array?
- Trouble with serialized metadata
- Query against multiple locations within single custom post type post
- Meta key in wp_query bug?
- Sorting Posts with meta value not working
- Custom Search Query – include only custom fields and title
- Extend search query to search meta keys values based on search string
- order by numeric value for meta value
- How do I query for posts by partial meta key?
- Use REGEXP in WP_Query meta_query key
- compare meta_query in get_posts arguments
- How can I use order_by to order by two meta_keys without excluding posts that don’t have those keys initialized?
- Function in array as arguments for WP_Query
- Is there a way to extend WP_query so Custom Post Types can have properties?
- WP_Query to show post from a category OR custom field
- WP_Query displaying ALL posts
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- Custom query with category exclusion and post-meta “whitelist”
- WP_Query not working as expected for attachments and custom meta_query
- Group posts by meta_key
- WP Query post meta value
- Would this post meta be better added to the post table rather than post_meta table
- Custom URl parameter
- Compile meta values from custom loop into array and then calculate sum total
- Order by meta_key in custom post type doesn’t affect the query
- Order posts by meta value and Date
- Efficient way to update multiple post meta
- Filtering posts by custom field value not working
- getting posts and number by specific meta value in multiple meta
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Order Posts by meta value AND published date
- Query post with meta_query where date is not in future
- wp_query add arguments using array_push if variable met
- WP_query posts closest to todays date
- How do I use wp_query for WordPress search?
- How To Fix WP Query Returns Results But Shouldn’t?
- Get posts for which a custom field is not present, with get_posts
- Output an array of terms for a ‘tax_query’ => array()
- How to Filter Posts by Custom Fields?
- How can I sort posts by the date and a custom meta field?
- Orderby is working with one query but not with other
- Adding multiple meta_key fields as orderby options to a WP Query via a function
- meta_value_num not ordering all items
- Custom WP_Query for WordPress Search Results with meta_query
- WP Group posts by year(desc) > month(desc) > date(asc)
- Is it possible to retrieve all posts with a certain value for metadata?
- wp_query get data from advanced custom field in wordpress
- How to compare a date in custom field with today’s date in custom WP_Query?
- Filter posts by comparing custom meta value against postdate
- WP_Query Meta_key is text value and need to sort as numeric not working
- filter wp_query result with custom field values
- WP ForLoop to compare meta information of posts to determine what post to display
- get_posts custom field
- wp_query posts with custom fields number smaller than
- Retrieve select tag custom values from array and display them in current page with wp_query?
- How to use a dropdown to filter posts by custom field
- How can I update post meta inside a WP_Query loop or the WordPress loop?
- Querying a large number of posts including their custom fields data
- Filtering by multiple conditions in the loop
- Orderby two meta fields not working
- Display count number of posts with the same specific meta_key meta_value
- Query posts by searching for a string in a meta field
- Query multiple post types, but different order for each
- Order by the first array within a meta_query
- Query ACF relationship field – Comparator IN – Value array
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- display ACF repater field in archive page
- Meta query ignores multiple values of the key
- Categories In English version showing not canonical URL, instead shows query search result
- Comparing Meta Field date in WPQuery using Meta_Query?
- WP_Query, ACF field and array
- Problem with my loops
- Order by Date Custom Field
- using custom meta user data to run queries in WordPress
- Look for string in posts and postmeta
- Query postmeta based on meta_value, return array of post_id
- update_post_meta() not updating
- I can’t get post based on its postmeta value and key
- Wrap group of wp query posts to parent div by date/year
- Sort by meta key within same day
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Order Custom Field by Price
- WP_Query to show post from a category OR custom field – Not 100% answered
- How to query post ids liked by the Author
- loop through custom post types with meta data
- Get posts by meta value except one post [closed]
- WP_Query by meta key not returning any posts
- How to get posts that have certain meta key value and order based on another meta key’s value