Jump to content

Help adding download button to all posts


jleone2008

Recommended Posts

I've added a download button to all of my posts using custom fields in wordpress. I know there is an easier way just not sure how. Right now I have to add the custom field on each post, instead I'd like to just have a download button (with css) automatically on all posts (download button will be going to the same url on each post).

 

My current code

<div id="downloadbutton">
<?php if(get_post_meta($post->ID, "download_link", $single = true) != ""){ ?>
    <a href="<?php echo get_post_meta($post->ID, "download_link", $single = true); ?>"<img src="http://www.MYSITE.com/images/downloadbutton.png" border="0"></a>
<?php } ?>
</div>

 

Appreciate the help!

 

Nevermind just figured it out! Took me awhile but glad I learned on my own. Was actually way simpler than I thought.

 

My code now

<div id="downloadbutton">
<center><a href="mydownloadurl" target="_self"><img border="0" src="http://www.MYSITE.com/images/downloadbutton.png"></a></center>
</div>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.