Add a "Download" button to your posts, pages or custom post types. This button will then create a zip file of the post attachments.
Simple and lightweight plugin to add a “Download” button to your posts, pages or custom post types.
This button will create a zip file of the post attachments on the fly and download it.
The output is very basic, no images, no fonts, no CSS. Just a simple button element.
Patches are welcome!
Feel free to post a request but let’s keep it simple and light.
Are you using the plugin? Do you like it? Do you hate it? Let me know!
First of all activate the Plugin, then you have three choices:
You can show the button after all your content (posts, pages, custom post types) by pasting this snippet at the end of your functions.php file of your theme:
function za_button_print($content) { return $content.za_show_button('Download'); } add_filter('the_content', 'za_button_print');
Alternatively you can print the button only in certain parts of your theme. Paste the following snippet wherever you want them to show.
Be aware, it should be within the Loop.
<?=function_exists('za_show_button') ? za_show_button("Download") : ''?>
Finally you can use the shortcode inside your post content like so:
[za_show_download_button text="Download the file"]
As you can see you can use your own text, the default value is “Download Attachments”.
Each method has a download counter, you need to add additional parameters:
A)
function za_button_print($content) { return $content.za_show_button('Download', 'true', '(% times)'); } add_filter('the_content', 'za_button_print');
B)
<?=function_exists('za_show_button') ? za_show_button("Download", "true", "(% times)") : ''?>
C)
[za_show_download_button text="Download the file" counter="true" counter_format="(% times)"]
NOTE: the default counter format is (%)
, where %
is actual number. The plugin will automatically replace this character with the download count.
You must specify where do you want to show the button your theme or post, check out the Installation instructions.
Absolutely. Use your theme CSS file to customize the appearnce of the button. The button comes with two CSS classes:
.za_download_button .za_download_button_loading