i am using a plugin (download monitor) to display downloads via shortcodes. the shortcode has a single parameter, which is the download's ID: [download id="123"]
i'd like to be able to modify the download ID parameter within the shortcode via a custom field value.
i've created a custom field - ur-single-form-id
- and also a shortcode for it [ur_single_form_id]
via the following function:
function ur_single_form_id() {
$cf = get_post_meta( get_the_ID(), 'ur-single-form-id', true );
$var = '<p class="your-class">' . $cf . '</p>';
return $var;
}
add_shortcode( 'ur_single_form_id', 'ur_single_form_id' )
this was in the hopes of being able to do something like this: [download id="[ur_single_form_id]"]
unfortunately things aren't parsed as expected, and i get an error saying "download not found".
how can i implement this such that the download ID is populated within the download monitor shortcode using the custom field value?
thanks
[download]
shortcode and make your own with it. First of all, you send shortcode as a string (its always a string) and download shortcode don't firedo_shortcode()
function or other filter to retrieve your value. Second thing:[download id="[ur_single_form_id]"]
this construction will never work, because you use square brackets inside square brakets. Wordpress will find starting[
of download shortcode and will find first]
which is the end of your shortcode. Just paste a code of download shortcode if you need help with it)<p>
tags inside your shortcode, just like you want to format it.