WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Advanced Custom Fields] checking the_field(); is causing it to print (1 post)

  1. atotalpirate
    Member
    Posted 7 months ago #

    I have if statements in my single.php that check to see if a field exists and to put the code in the if statement if it does. The problem is it's printing the value of the_field('field') that I'm calling as well as puts the code in the if statement. Below is the code and I get the_field('field'); value in the website in "Quotes".

    <?php if (the_field('poem_title_1') !== false ) : ?>
    
    		<li>
    			<div class="graphic-bg" style="background-image: url(<?php echo the_field('poem_image_1'); ?>); background-size: cover;"></div>
    
    			<div class="poem-wrap">
    
    			<section>
    				<h1 class="titles poem-title"><?php the_field('poem_title_1'); ?></h1>
    			</section>
    
    				<div class="poem">
    					<?php the_field('poem_1'); ?>
    				</div>
    
    			</div>
    		</li>
    
    		<?php endif; ?>

    It's not goint to ruin the website, I can just keep the content on top of it but it adds in like 1px or margin and I don't want to sweep that under the digital rug so to speak. I'm hoping someone knows why it's printing and can tell me how to MURDER it.

Reply

You must log in to post.

About this Topic