• Resolved vickkmartinez

    (@vickkmartinez)


    I created a doc and added a custom field in order to add it to the shortcode template. I edited shortcode.php and added the following code:

    <?php 
       $value = get_field( "resumen_doc" );
    
       if( $value ) {
          echo $value;
       } else {
         echo 'empty';
       }
    ?>

    It doesn’t work (It’s like it’s empty but it’s not). It works on single-doc.php but not in shortcode.php

    Thank you!

    • This topic was modified 3 years, 11 months ago by vickkmartinez.
Viewing 1 replies (of 1 total)
  • Thread Starter vickkmartinez

    (@vickkmartinez)

    Sorry I solved this. I forgot to add the doc id:

    <?php 
                        $value = get_field( "resumen_doc", $main_doc['doc']->ID );
    
                        if( $value ) {
                            echo $value;
                        } else {
                            echo '<p></p>';
                        }
                    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Advanced custom fields’ is closed to new replies.