You’ll have to show more of the relevant code, but, to begin with, if you want to check for the availability of a ‘preparation_time’ ACF value, use
if ( get_field( 'preparation_time' ) ) : // get_field(), not the_field()
As the ACF docs put it, the_field( 'field' )
is the same as echo get_field( 'field' )
– so wouldn’t return true or false, but instead simply print (if you get to it).
I’d probably write it
if ( get_field( 'preparation_time' ) ) {
echo get_field( 'preparation_time' ) .
' 40 MINUTES PREP/COOK' ;
}
But no guarantees, since I don’t know the context.
Related Posts:
- How to change upload directory in wp_handle_upload
- What exactly does “Posts page” do in WordPress?
- How do I make my function add variables/values to the $post object?
- Calculate percentage of post by category
- Change comments form title on a page by page basis
- the_title() & the_content() are retrieving Post details inside a Page, after calling a shortcode
- register_rest_route regex option for base64 or alternate
- “Can’t use function return value in write context” error
- Displaying Only Certain Tags in Loop
- Customized title tag for each page in pagination?
- Can is_page() be combined with a switch control structure?
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- WordPress automatically adds tags when pasting code, how to stop it?
- ACF: Only get first row of a Repeater Field
- WordPress (3.9.1) MultiSite Permissions. Is chown the answer?
- have_posts() execution failure
- WordPress with php 5.5 and zend opcache
- Woocommerce add to cart quantity buttons with AJAX
- How can I use wp_query to show all product data using just the products ID?
- WP add_action factory
- my posts are saved as drafts
- save imported posts as drafts
- How to show phpinfo() only in a new tab?
- Create a range slider to change font-size with different screens sizes in wordpress customizer api
- Ajax load more posts with multiple tax query
- Ajax call not working
- Are there security or other issues with changing PHP time limit and max input vars?
- Auto-Select Parent Category as Primary
- How can I pass a custom/dynamic product to the Woocommerce cart?
- Long running queries
- comments sorting incorrectly across multiple pages
- Irregular TTFB and server wait time response
- Saving plugin settings – ERROR: options page not found
- WP_Query fails despite having 1 post
- Download PDF after CF7 form submission
- 3 different times on my WordPress website
- Flexslider won’t work on WordPress
- Do I have anything to worry about when switching to a default theme to test for plugin conflictions?
- Unable to Find Space in Custom Function
- Unable to process php via shortcode
- Is it possible to create new user from external form using REST API?
- WP_Query: getting posts where custom field exists
- Foreach loop inside an array_merge
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Show the section only if custom taxonomy was chosen
- How to separate categories with commas?
- Cant display an image via PHP in wordpress
- Template Loop – add switch case php
- Disable if there are no children – Woocommerce
- How to hide post in WordPress
- using wp enqueue style to create a CSS file specifically for a page template
- The user can only see their own profile
- Hide a div when a custom field is empty
- Shortcode for a Series of Elevating Image Files, Excluding a Range?
- Fatal Error wp-settings.php on line 119
- How do I custom code the start page?
- what does $options = get_option(‘test_theme’); do?
- Is it possible to isolate and use WordPress functions outside of wordpress
- Remove password protection from all posts
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- Adding a custom meta field with default NULL value which is not selectable
- Custom html/php/jquery map code in WordPress/elementor?
- How to change basename url for wp-admin?
- Prevent header and footer from loading on specific pages with template or plugin
- Get taxonomy terms that share a common object property
- My Custom Post Type AJAX Query is Returning no posts – why?
- Styling a category link
- Woocommerce display orders with products from specific categories to specific admins
- How to exclude meta no index pages from wp_list_pages
- Current WordPress Page Title as Search Parameter into A Tag
- Limit the number of characters/words in an excerpt for a related posts section
- Yoast Breadcrumbs Inject Multiple Levels
- Remove all feeds and return custom 404 page
- Maximum file Upload
- wp_get_nav_menu_items() with ACF
- Primary navigation menu with timed items from custom post type
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- Different Logo for Different Pages
- Deny php execution in /wp-includes – using .htaccess in /wp-includes VS root folder
- WooCommerce – Add Shipping class below each product in Shopping Cart page
- Escaping a Single Quote in str_replace for Nav Function
- Use fetch_feed(); Totally Outside of WordPress?
- SQL Query Search page
- Unable to get Post Category Name and URL
- Create a dynamic buddupress tab
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Would it be possible to route WordPress Through an MVC Application
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- jQuery vs. $ – Creating jQuery scripts in JavaScript in WordPress using External Libraries
- When I use rewind_post() it shows menu items in my loop
- Problem using explode inside add_shortcode() callback funciton [closed]
- How to post data to a word press site in case of a mobile app
- What languages were used to build WordPress? [closed]
- How to strip/remove all blank spaces at the beginning/end of a search string
- How to create categories out of a list of words?
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Difference between php memory limit and wp memory limit?
- why is kses removing semicolon from inline style?
- get_post_meta returns on side but it doesn’t return on bottom of admin page