How can I display the value of a field in WordPress + PHP?

I installed this plugin and created a custom fields called “imagine”

Field appeared in the admin panel, insert images but nothing is display…

Read More

I tried to use this code but unfortunately still does not work.

<div class="selectat">
    <div>
        <?php $variable = the_field( 'imagine' );?>
        <?php echo $variable;?>
    </div>
</div>

It is wrong parameter? I put one image to understand more clearly what I do.

enter image description here

This is the error:

Fatal error: Call to undefined function the_field() in /home/dgsite81/public_html/bagel/bagel/wp-content/themes/WordPressBootstrap-master/archive.php on line 23

Simply want to display the value of a field … I use correctly function or should another?

Thanks in advance!

Related posts

1 comment

  1. the_field() is part of ACF Plugin and you’ve used types
    So better to use their functions,

    For example:

    $trainer_email_address = types_render_field("email",array("raw"=>"true","separator"=>";"));
    

    In your case,

    $variable = types_render_field("imagine", array("output"=>"html") );
    

    Read More Here

Comments are closed.