Hi @serviceweb
Looking at your code, I believe you need to put the code in “content-loop.php” file. You can try this code if you want:
<?php
$the_link = get_permalink();
if( get_field('url_field_past') ) {
$the_link = get_field('url_field_past');
}
?>
<a href="<?php echo $the_link; ?>" ><?php the_title(); ?></a>
If you don’t know how to code or not familiar with WordPress template, I suggest you hire a developer to help you out with it, and I’d recommend looking for one on https://studio.envato.com/ or https://www.upwork.com/.
Hope this helps 🙂