Support » Plugin: Download Shortcode » Forcing download in another way?

  • J



    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?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Drew Jaynes


    WordPress Core Developer

    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?



    It will return the full file url, like:

    Thanks for trying to help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Forcing download in another way?’ is closed to new replies.