Home Forums General Issues Check if exists fields functions.php


Check if exists fields functions.php

  • i want to display a popup on single product page. The field only display when exist. Below is my code that i have used in functions.php but its showing although does not any data on the field.

    add_action( 'woocommerce_product_thumbnails', 'bbloomer_display_acf_field_under_images1', 20 );
    function bbloomer_display_acf_field_under_images1() {
    echo "<a href='#contact_form_pop' class='fancybox-inline popup-vid-up'>Product video</a>";
    echo "<div style='display:none;' class='fancybox-hidden'>";
    echo "<div id='contact_form_pop' class='hentry' style='width:460px;max-width:100%;'>";
    echo get_fields('product_video');
    echo "</div>";
    echo "</div>";	
  • You need to check if the field has content

    if (get_field('product_video')) {
      // your echo statements go here
  • wow this is working perfectly…
    Thanks john huebner

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

The topic ‘Check if exists fields functions.php’ is closed to new replies.