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!

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.