Hi,
I am trying to add a meta field for a link made in Advanced Custom Fields to an Essential Grid skin. I’ve created the ACF field and (with your help) got it to display on the single post and category pages by adding this code to the _content.php file.
<?php $link = get_field('trailer'); if( $link ): $link_url = $link['url']; $link_title = $link['title']; $link_target = $link['target'] ? $link['target'] : '_self'; ?><a class="button" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><?php echo esc_html( $link_title ); ?></a>
<?php endif; ?>
Now I would like to display this button (or link) in an Essential Grid skin. I’ve created an ES alias (egl-trailer), and added a meta field for this alias to the skin. But the field doesn’t display properly, and I can’t get it to link to the URL in the ACF link. (If I use _trailer as the meta field in the ES skin, a proper button displays, but with the wrong title, and again, it doesn’t link to the URL.)
Here’s a page with the ACF field for “trailer” properly displayed:
https://staging4.upstatefilms.org/pain-and-glory
Here’s the page where I’m trying to get the link to display. It now shows as a tiny red button next to “Get more details.”
https://staging4.upstatefilms.org/x-home
As an alternative approach, I can create an ACF group with a text field for the URL and a text field for the title, and I can get Essential Grid to display the title with the right URL. But this will require re-doing the code for the _content.php. If that’s a better approach, can you help with the new code to display the link in single post and category pages?
Thanks for any help you can provide.