Display ACF file field as a button on post template

Hi,
I’ve successfully added the code for my file upload from ACF to my single post template and would like to have the link as a button rather than just text as a link. I attempted to add a ‘get shortcode’ prompt but this didn’t work. Here’s what I have added in the template:

<?php if( get_field('file_upload') ): ?>
<a href="<?php the_field('file_upload'); ?>" >Download File</a>
<?php endif; ? Thanks!

Hi Felicity,

Thank you for writing in, you can add the class x-btn and x-btn-global to your text so it can inherit the general styling of your site button.

You can also add a custom class to it, just in case you want to customize it.

e.g.

<?php if( get_field('file_upload') ): ?>
    <a class="x-btn x-btn-global my-custom-class" href="<?php the_field('file_upload'); ?>" >Download File</a>
<?php endif; ?

You can find the proper CSS code selector using the Chrome browser Developer Toolbar
For the CSS code itself, I suggest that you get started with this tutorial

Please note that this is a customization and we can not provide further support to it.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.