So it looks like you’re asking for help w/ one of our pro extensions (namely, Buttons). We’re not allowed to offer support for our PRO features on the free w.org forums.
Please contact us via our contact form, on our website.
This is not a request regarding buttons.
I just want to know, how I “register” a new template.
Overriding an existing template by coping it to mytheme/download-monitor/ works. But placing a new template into mytheme/download-monitor/ doesn’t work, because styles get lost.
Placing a new template into plugins/download-monitor/template works. But of course this is not the expected way how to extend the templates.
Hello @schwefel ,
Everything you configured is correct. The issue comes from the quotation marks used in the example. They are not standard quotes, so WordPress cannot parse the shortcode properly.
Please use regular double quotes like in the example below:
[downloads template=”button2″]
After replacing the quotes, the template should load as expected.
Let us know if it still does not work and we will gladly assist further.
Unfortunately that doesn’t work.
I already used standard quotes. (they just got messed up while typing this post)
The new template is certainly found by the shortcut, as any changes I make to the template will be shown on the web page.
Only issue: the style gets lost.
Hello @schwefel
Could you please provide more details about what you mean by “the style gets lost”? Which specific styles are you referring to?
A detailed description of the steps required to reproduce the issue would be very helpful.
Thank you.
As written in the original post:
If I edit the template, then the download is shown as a clickable button. Html code: class=”download-link download-button aligncenter”
If I copy the template into a new file, then the download is only shown as a text link. Html code: class=”download-link”
Hello @schwefel ,
I now have a clearer understanding of the issue. It’s not that the style is being lost, but rather that the template button class download-button is not being applied. This class is automatically added by Download Monitor (DLM) to support the default template styles that are included with the plugin. If a user chooses to create a new template, they will also need to style that template as needed.
In your specific case, you would like to replicate DLM’s default button styles in your custom template. For this project, I can offer two suggestions.
1. Rewrite the link tag
<a href="<?php echo $download->get_the_download_link(); ?>" class="download-link download-button my-custom-button-class">
Button 2
</a>
2. Add this function in your theme’s ( child theme preferably ) functions.php file
add_filter( 'dlm_template_attributes', 'dlm_add_custom_template_class', 10, 3 );
function dlm_add_custom_template_class( $attributes, $download, $template ) {
if ( 'button2' === $template ) {
$attributes['link_attributes']['class'][] = 'download-button';
}
return $attributes;
}