Suport » Șabloane și ajutor la personalizare » Adding a download button with script to post

  • I need to add a download button to all my photos from my posts. Every post has one photo. The download manager is no good because I have to upload and rename everything again, but even so it doesn’t look good. Is there a way to create the button and a script so that after inserting the code to all my posts, or even a css, my download button will do it’s job with the existing photos? My website is : http://getphotos.eu
    thank you!

Vizualizare 2 răspunsuri - 1 la 2 (din 2 în total)
  • Moderator jnhghy

    (@jnhghy)

    Hi,
    I really don’t think this is possible without adding custom php code.
    One way to achieve this without changing the theme is to add 2 plugins:
    PHP Code Widget and WP-Force Images Download.
    Then you’ll have to add the php code widget in your website where you want your downloadable image to be.
    Next you’ll add this code to your php widget:

    <?php if (has_post_thumbnail( $post->ID ) ):
       $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    endif; ?>
    
    [wpfid link="<?php echo $image[0];?>"]

    if all works as expected you should get the result your are looking for.

    Thank you for the response, I tried everything but it’s not working. I don’t know why. When I put the short code in the post it shows me the download button but also this: „;?>„]” underneath, exactly as quoted, and when I click download it opens a page that says „No Way!” @ this link „http://getphotos.eu/wp-content/plugins/wp-force-images-download/fd.php”. If I use the short code „[wpfid]” it downloads a 0kb file. What to do ?

Vizualizare 2 răspunsuri - 1 la 2 (din 2 în total)
  • Subiectul ‘Adding a download button with script to post’ este închis pentru noi răspunsuri.