Home › Forums › Front-end Issues › Display ACF Field in Raw HTML Code
Hi,
I have a URL Field in ACF with the name of citation_pdf_url. This contains the PDF link to the document of each post and I need to display a button in the post to Download PDF and fetch the URL from citation_pdf_url. I am using tagDiv Composer of Newspaper 11 theme. However, I am not able to get the output of the button using the ACF field.
I have used this HTML Code
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
.button {
background-color: #1c87c9;
border: none;
color: white;
padding: 20px 34px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
margin: 4px 2px;
cursor: pointer;
}
</style>
</head>
<body>
Click Here
</body>
</html>
But the output is not downloading the file, as this href code is not printing the acf value.
I also tried these values in ahref field:
[acf field="citation_pdf_url"]
get_field(citation_pdf_url)
$the_field=”citation_pdf_url
$get_field(citation_pdf_url)
<?php the_field(‘citation_pdf_url’); ?>
But not working.
Please help me. How can i use acf value in Raw HTML as that is the only option to create and display a button.

An ACF file field has these return types: File Array (array), File URL (string), or File ID (integer).
ACF will not automatically output a link to the file. You must create this yourself. For example if the return type is URL then
$url = get_field('citation_pdf_url');
?><a href="<?php echo $url; ?>">Click Here</a><?php
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.