jleone2008 Posted July 29, 2010 Share Posted July 29, 2010 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 https://forums.phpfreaks.com/topic/209189-help-adding-download-button-to-all-posts/ Share on other sites More sharing options...
jleone2008 Posted July 29, 2010 Author Share Posted July 29, 2010 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 https://forums.phpfreaks.com/topic/209189-help-adding-download-button-to-all-posts/#findComment-1092445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.