Home Forums ACF PRO Display specific text when field is empty


Display specific text when field is empty

    • gegeor

    • June 3, 2019 at 6:37 pm

    I have a field for displaying youtube video and i would like to display a message like : no video” when this field is empty

    i tried this

    function woo_new_product_tab_content() {
    	// The new tab content
    	//echo '<h2>New Product Tab</h2>';
    	//echo '<p>Here\'s your new product tab.</p>';
            echo get_field('video_link', $post_id);
    	echo $youtubevideo_code = wp_oembed_get( get_field('video_link') );
    	if($youtubevideo_code) {
        echo '<b>No video </b>';
       // echo $materia;

    but doesnt work
    any ideas please?
    Many thanks

    $youtubevideo_code = get_field('video_link', $post_id);
    if ($youtubevideo_code) {
      // show video
    } else {
      // show no video message
    • gegeor

    • June 5, 2019 at 3:43 am

    Many thanks John:) works perfect!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.