Buttons

The Buttons extension for Download Monitor allows you to create new button templates without having to do any coding!

Installation

  • Unzip and upload the plugin’s folder to your /wp-content/plugins/ directory
  • Activate the extension through the ‘Plugins’ menu in WordPress

For more information on installing and managing plugins see here

Usage

After installing the extension, a new sub-menu item is added to your Downloads menu item called “Buttons”. On this new page you can add, edit and delete your new custom button templates.

Creating a new template

A new Buttons template can be added via the Buttons overview page. Click on the new “Buttons” sub-menu item, located under Download in your WordPress admin menu. At the top of this page is a form you can use to create a new template. After creating the template, you will be automatically redirected to the page to edit that template. All templates are created with a default configuration to get you going but all values can be changed in any way you like.

Add a new template by entering the new name (1) and press the “Add Template” button (2).

Editing a template

After adding a new Buttons template, or by clicking on the edit action on one of your existing templates, you are taking to the edit screen. On this screen, you can edit all of the stylings of your button. After changing any of the styling options, the live preview (3) will automatically update to reflect the change. Please note that the button is not stored until you click the “Save Button” button (2). After you’re done editing your button, you can go back to the overview screen with the “Back to overview” button (1).

Download Monitor - Buttons Extension - Editing a Buttons template

On this screen, you can edit all of the stylings of your button. The live preview (3) will display your changes directly as you do them. This way you are sure your buttons look the way you want them to.

Using a Buttons template in a shortcode

After you’ve created the Buttons template and set it up the way you like it, it’s time to use it on your website. You can use your new template in the same way you’d use a normal Download Monitor template. With the only difference being you will have to prefix you template name with dlm-buttons-. If you’re using the generated shortcode from the Buttons overview screen, this is already done for you.

Here we are displaying our new button for our download with ID 1607!

Setting the Buttons template from the default WordPress editor

Go to your Pages/Posts and create a new one or use an existing one. To connect the download button with the download file, click on “+”, and add the Download Button block.

Next, you’ll need to customize a few things:

  • Download – you’ll need to select the file you want to connect with the download button;
  • Template – in our case, we’ll select the custom template;
  • Custom template – add the shortcode from the button template (in my case: [… template=”dlm-buttons-my-new-template“];

Click Publish or Update and your files are ready to download!

Setting a Buttons template as default template for all buttons

If you created a new template you’d like to use for all of your Download Monitor buttons, you can set it as the default template. This can be done in your default Download Monitor options. In the options screen, first tab (General), the first option is called Default Template (1). If you change this option to Custom Template, a new field called Custom Template (2) will appear. In this new field (Custom Template), enter the name of your Buttons template. Note that this should include the dlm-buttons- prefix. After you’ve done this, save the page by clicking the Save Changes button. Now all your Download Monitor shortcodes that have no specific template assigned to them will use your new Buttons template.

Download Monitor - Buttons Extension - Set a new template as default template

In the Download Monitor settings, you can set your new Buttons template as the default template for all your download shortcodes.

FAQ

Why is “dlm-buttons-” prepended to my template name?

Because Download Monitor works with template files out of the box, we needed a way to identify the special templates created by the Buttons extension. This is what the "dlm-buttons-" prefix does. You don’t have to add this to the template name when you create a template but you do need to add this when using the template name in your shortcodes.

Is HTML allowed in the button text?

Some HTML tags are allowed in the button text. Tags that are allowed are: <b><strong><i><em><u><small><br>.

You can add new allowed HTML tags to this list with the dlm_buttons_text_allowed_html_tags filter. An example of adding a tag (div) is:

add_filter( 'dlm_buttons_text_allowed_html_tags', function ( $tags ) {
$tags[] = "div";

return $tags;
} );

How are the Buttons templates stored?

The template configuration is stored in your WordPress database in a custom table named wp_dlm_buttons (the wp_ may be different if you’ve changed your database prefix). We store not actual files on your server, the buttons are generated on the fly. Please note that if your database output is cached, our button config will be cached as well.

Was this article helpful?

Related Articles