
I’m using the following code:
<?php
$posts = get_field('customers');
if( $posts ): ?>
<?php foreach( $posts as $post): ?>
<?php setup_postdata($post); ?>
<div class="tile">
<a class="img" onclick="ga('send', 'event', 'case study', 'click', {'page': '<?php echo $_SERVER['REQUEST_URI'];?>'})" href="<?php the_permalink();?>">
<?php the_post_thumbnail(); ?>
</a>
<div class="title" onclick="ga('send', 'event', 'case study', 'click', {'page': '<?php echo $_SERVER['REQUEST_URI'];?>'});window.open('<?php the_permalink();?>', '_parent');">
<h3><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
<span class="label"><?php echo wp_trim_words(get_field('headline'), 7, '<a href="'. get_permalink() .'"> ...read more</a>' ); ?></span>
</div>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Which works splendidly on local, but once it’s published live, this line:
<?php echo wp_trim_words(get_field('headline'), 7, '<a href="'. get_permalink() .'"> ...read more</a>' ); ?>
Does not work, specifically the ‘headline’ field.
Any thoughts?