I'm trying to output content from an Advanced Custom Fields (ACF) in my wordpress theme. At the moment though, all I'm getting is the plain text content from the ACF inside double quotation marks, not inside the div
and h1
tags.
The code is copied from another theme I made where it worked, which makes me think something is interfering with it somewhere?
<?php $process_title = the_sub_field('process_title'); ?>
<?php if(!empty($process_title)) : ?>
<div >
<h1 >
<?php echo $process_title; ?>
</h1>
</div>
<?php endif; ?>
CodePudding user response:
Thanks to @M.Eriksson, the correct code should be:
<?php $process_title = get_sub_field('process_title'); ?>
<?php if(!empty($process_title)) : ?>
<div >
<h1 >
<?php echo $process_title; ?>
</h1>
</div>
<?php endif; ?>
CodePudding user response:
<?php
$process_title = the_sub_field('process_title');
if(!empty($process_title)) {
echo "<div class='process-title'>";
echo "<h1 class='process-heading'>";
echo $process_title;
echo "</h1>";
echo "</div>";
}
?>