Displaying amount of downloads on WordPress plugin Download Manager

What to do for the FREE version of WPDM display the amount of downloads (download count) and other information in the Frontend?

wpdm1

Problem

There are several WordPress plugins for managing downloads. One of them is the Wordpress Download Manager or simply WPDM. The problem is that the FREE version may be limited, Depending on your need. I just needed to upload files to link to a Post, so that visitors could view the file information (name, size, amount of downloads, Description, etc) and then download it, If I need.

When installing the WPDM, free version, I noticed it wasn't displayed in the Frontend some of this information, mainly the amount of downloads ever made (download count).

Solution

Is there an easy way to figure this! Here's an example of the download link (DEMO): Free software coding and Cryptography

Step 1 | Install the plugin WPDM
Install the Wordpress Download Manager, activate the plugin, go in the menu Downloads (to the left) , and then click “Add New” (Add New).

Step 2 | Upload the file
Enter the basic data about the file such as title, Description and upload the file (button “Select files”, to the right). If you want to, You can still enter the initial amount of download in the field “Download Count”. At the end, click “Publish”.

Step 3 | To bind the file with the Post
If you click again on the menu “Downloads”, you will see that the file just upload is already on the list. Just copy the “Short code”, something like “[wpdm_package id = ' 3574 ']” and paste into your Post, at the exact location where you prefer the download link appears.

Step 4 | Presentation of the download link / Templates
Here is the “Holy Grail”! If you're in the Frontend and see the Post, Notice that the link already appears, but some desirable information not. In my case, I wanted to display the amount of downloads, IE, the counter that increments automatically with every click.

All you need to do to display the download counter is:
(1) Open the file WP-content/plugins/download-manager/tpls/link-templates/link-template-default.php; and
(2) Insert the short-code [download_count] where you want the counter to appear.

Important: regarding downloads counter, the WPDM plugin behaves a little different from the usual, until I thought it was a defect. He just increments the value only once by browsing session. IE, even if you take several clicks to download the file, just tell the first, until the session is shut down, closing the browser, for example.

Short codes

Although the FREE version doesn't make overtly, There are many other short and-codes which we can use. By the way, in this file link-template-default.php You can build a completely custom layout, set position, colors, width, buttons and what more you want.

Looking at the source code, I noticed that you can use most of the short codes of Array below to view specific information, as for example use the key [excerpt] to show the contents of the field “Summary” or [Description] to show the contents of the field “Description”, concerning the registration screen Downloads.

print_r($package)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
 
Array
(
    [_ edit_lock] => 
    [_ edit_last] => 
    [files] => Array
        (
            [0] => arquivoparadownload-20161028.zip
        )
 
    [version] => 
    [link_label] => Download
    [quota] => ∞
    [view_count] => 1579
    [download_count] => 1580
    [access] => Array
        (
            [0] => Guest
        )
 
    [password] => 
    [icon] => <IMG class="wpdm_icon" ALT="Icon"   src="http://domain.com/wp-content/plugins/download-manager/assets/file-type-icons/download.png" />
    [_ _ wpdmx_user_download_count] => Array
        (
            [1] => 1
        )
 
    [MASTERKEY] => xxx
    [package_size_b] => 2275
    [package_size] => 2.22 KB
    [ID] => 3552
    [post_author] => 1
    [post_date] => 2016-10-11 18:16:44
    [post_date_gmt] => 2016-10-11 21:16:44
    [post_content] => Este é o conteúthe / Description
    [post_title] => nomedoarquivo.PHP
    [post_excerpt] => Aqui vai o resumo
    [post_status] => publish
    [comment_status] => open
    [ping_status] => closed
    [post_password] => 
    [post_name] => Name the Post
    [to_ping] => 
    [pinged] => 
    [post_modified] => 2016-10-11 18:45:33
    [post_modified_gmt] => 2016-10-11 21:45:33
    [post_content_filtered] => 
    [post_parent] => 0
    [guid] => http://dominio.com/?post_type=wpdmpro&#038;p=3751
    [menu_order] => 0
    [post_type] => wpdmpro
    [post_mime_type] => 
    [comment_count] => 0
    [filter] => raw
    [ancestors] => Array
        (
        )
 
    [post_category] => Array
        (
        )
 
    [tags_input] => Array
        (
        )
 
    [title] => Titulo the Post
    [Description] => <p>A descrição</p>
 
    [excerpt] => O resumo
    [author_name] => Taylor Lee
    [author_profile_url] => http://domain.com/?author=1
    [preview] => 
    [create_date] => 11 October 2016
    [update_date] => 11 October 2016
    [categories] => 
    [file_count] => 1
    [page_link] => <a href='http://domain.com/?wpdmpro=arohamqr-php'>file.PHP</the>
    [page_url] => http://domain.com/?wpdmpro=arohamqr-php
    [btnclass] => [btnclass]
    [tags] => 
    [file_ext] => zip
    [file_size] => 2.52 KB
    [thumb_widget] => 
    [thumb_gallery] => 
    [thumb_page] => 
    [thumb] => 
    [additional_previews] => Array
        (
        )
 
    [download_url] => http://domain.com/?wpdmpro=arohamqr-php&wpdmdl=3552
    [download_link] => <the class='wpdm-download-link wpdm-download-locked [btnclass]' rel='nofollow' href='#' onclick="location.href='http://domain.com/?wpdmpro=arohamqr-php&wpdmdl=3552';return false;">Download</the>
    [download_link_extended] => <the class='wpdm-download-link wpdm-download-locked [btnclass]' rel='nofollow' href='#' onclick="location.href='http://domain.com/?wpdmpro=arohamqr-php&wpdmdl=3552';return false;">Download</the>
    [download_link_popup] => <the class='wpdm-download-link wpdm-download-locked [btnclass]' rel='nofollow' href='#' onclick="location.href='http://domain.com/?wpdmpro=arohamqr-php&wpdmdl=3552';return false;">Download</the>
    [formatted] => 1
)

Templates

Particularmente estou usando uma adaptação da template “Call to Action 3” disponível no próprio diretório wp-content/plugins/download-manager/tpls/link-templates/. Além do contador de downloads, utilizo também um botão personalizado ao invés de simplesmente um link com rótulo “Downloads”, conforme abaixo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!-- WPDM Link Template: Call to Action 3 / UPDATED By Taylor Lopes -->
 
<blockquote class="well c2a3">
    <div class="media">
        <div class="pull-left" align="left">
            [icon]
        </div>
        <div class="pull-right" align="right">  
            <a href="[download_url]"><img src="<path-To-Image-Button>/download-button.png" /></the>
        </div>
        <div class="media-body">
            <H3 class="media-heading" style="padding-top: 0PX;border:0PX;margin: 0 0 5PX 0;font-size:12pt;"><a style="font-weight: 700" href="[page_url]">[title]</the><Br /><span style="margin-left:0PX;font-size:8pt;font-weight:300"><i style="margin: 2PX 0 0 5PX;opacity:0.5" class="fa fa-th-large"></(I)> [file_size] <i style="margin: 2PX 0 0 5PX;opacity:0.5" class="fa fa-download"></(I)> [download_count] downloads</span></H3>
            [Description]
        </div>
    </div>
</blockquote>
<style>.well.c2a3 .btn.wpdm-download-link{ padding: 11px 30px;font-size: 11pt; } .well.c2a3 .Media-body{ font-size: 11pt; } .well.c2a3 .wpdm_icon{ height: 42PX; width: auto; }</style>
Total hits: 3889

Leave a reply

The your email address will not be published. Required fields are marked with *