Site logo

Archived topic

ACF Shortcodes

5 replies · Started by Beau on February 14, 2018

Viewing posts 1–6 of 6

I’m trying to create a simple shortcode that pulls a file’s URL from an Advance Custom Field File field (like a PDF) and creates a standard text link with it.

So for my client, they can upload new PDF and then it’s automatically added to the text link.

What is the best way to do this using functions.php and shortcodes?

If it's for your client to add to their pages as needed, I would use a shortcode.

Let me know if you need more info :)

This is driving me bananas. It is not working correctly and it is also placing the text from the shortcode in the top left corner of the page.

`function dinner_menu() {
echo '<a href=\"';
echo the_field('dinner');
echo '\">Dinner Menu';
}
add_shortcode('dinner', 'dinner_menu');'

The shortcode field is a File and the return value is a File URL of a PDF uploaded by WordPress. I know this is more of an ACF issues, but can you help? Thanks in advance.

URL: https://staging.thatplaceinogunquit.com/menus/

Got it, thanks!

You're welcome :)

This archived topic is closed to new replies.