WordPress.org

Ready to get started?Download WordPress

Forums

Download Shortcode
Forcing download in another way? (3 posts)

  1. J
    Member
    Posted 1 year ago #

    Hi,

    I am trying to use this plugin in a slightly different way and perhaps you'd know if and how I can do it.

    I am using a php widget (a widget that allows php) because I need to pull the file name dynamically with this code:

    <?php the_field('downloadable_material'); ?>

    This widget does not allow shortcodes for some reason, but if I use the do_shortcode php line, i can't seem to insert the php code above inside the shortcode that is inside the do_shortcode php.

    Which would end up something like this:

    <?php echo do_shortcode('[download]<?php the_field('downloadable_material'); ?>[/download]'); ?>

    which obviously doesn't work.

    I am also unable to use the wp-content/force-download.php?file= inside the middle of the link because it pulls the full url as is from the php code the_field I mentioned.

    Any other suggestions?

    Thanks

    http://wordpress.org/extend/plugins/download-shortcode/

  2. Drew Jaynes (DrewAPicture)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    The shortcode relies on the ability to take the URL (relative to /wp-content/), split and rejoin it to form the forced-download link. Out of the box, what you're trying to do probably isn't possible.

    Can you provide an example for what the_field( 'downloadable_material' ); might return?

  3. J
    Member
    Posted 1 year ago #

    It will return the full file url, like:

    http://www.mywebsite.com/wp-content/uploads/file.pdf

    Thanks for trying to help

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.