I’m using the advanced custom fields to add some call to action options for some of my posts. Specifically, I’m trying to use the plugin to make a link and then use that link as the href for a button on a post. The following code is getting me close but I had to manually add the href to my button tag. I left in the code “the_field(‘call_to_action_link’:wink: as it currently displays the actual link text which is what I want my href to equal. What I’m trying to do is us that function to replace the manually input href. How would I use the php function within my html to dynamically populate the href based off of the custom field for that particular post?
`<?php
if(get_field(‘call_to_action_text’:wink:) {
echo ‘<div class = “call-to-action”>’;
echo'<p>’ . get_field(‘call_to_action_text’:wink: . ‘</p>’;
the_field(‘call_to_action_link’:wink:;
echo ‘<button href = “http://localhost/cpt_class/?p=1175”>text</button>’;
echo ‘</div>’;
}
?>`