Need help: how to create a shortcode containing a dynamic value
-
Hi,
I’m trying to create a shortcode, that could contain a value that would be dynamic.
For instance, I want to create a shortcode so a user can download a zip file. but I want to be able to specify the name of the zip file each time. Like this:
[zip “filename.zip”]
(I don’t know if my syntax is correct or not?)The idea would be that the shortcode “zip” would launch a php code, that contains an “a href” to a folder, and the value “filename/zip” would be the file to fetch at that “a href”.
More precisely, here is the code I am using (I use POST SNIPPETS plugin to create the shortcodes):
if($api->haveSubscriptions($api->getCategoryProducts(46)){
print “<a href=http://www.website.com/folder/filename.zip
>download zip”;
}else if($api->getUser()){
print “user doesn’t have access”;
}else{
print “Guest”;
}In the code above, I want to replace “/filename.zip” with a dymanic value that would be defined into the shortcode.
[zip “filename.zip”]Is this possible>
Thanks!
- The topic ‘Need help: how to create a shortcode containing a dynamic value’ is closed to new replies.