1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help adding download button to all posts

Discussion in 'PHP & Perl' started by jleone2008, Jul 29, 2010.

  1. jleone2008

    jleone2008 Junior Member

    Joined:
    Apr 26, 2010
    Messages:
    125
    Likes Received:
    11
    EDIT: Nevermind just figured it out! Brand new to php so took me awhile. :p

    I have added a download button to all of my posts using custom fields in wordpress. I was wondering if there was a simpler way of doing this though, I know there is just not sure how.

    My current code
    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>
    I have that code in my single.php file, what can I use instead so I don't have to add the custom field each time I post? BTW the download button will be going to the same URL on each post.

    EDIT: Nevermind just figured it out! Brand new to php so took me awhile. :p
     
    Last edited: Jul 29, 2010