GitHub Release Downloads allows you to get the download count, links and more information for releases of GitHub repositories.

The plugin adds the following shortcodes to WordPress:

Download count

The shortcode [grd_count] returns a number corresponding to the sum of all download count values for the selected releases. For instance, you can get the number of total downloads for one GitHub repository.

Attributes Description
user the GitHub username
repo the GitHub repository name
latest only gets information about the latest published release for the repository
tag only gets information about the release with the specified tag name
prereleases includes draft releases and prereleases. Default value is false.
Examples
All repository downloads [grd_count]
[grd_count user="IvanRF" repo="MassiveFileRenamer"]
Latest release downloads [grd_count user="IvanRF" repo="MassiveFileRenamer" latest="true"]
Specific release downloads [grd_count user="IvanRF" repo="MassiveFileRenamer" tag="v1.6.0"]

Note: user and/or repo can be omitted if default values are set. See Settings.

Release downloads list

The shortcode [grd_list] returns an HTML list for the selected releases including the release tag name, the release description and the list of files that can be downloaded, like release assets or the source code.

For styling, class selectors are provided (e.g.: release-downloads-header, release-downloads, release-name, release-size, release-download-count).

Attributes Description
user, repo, latest, tag, prereleases same as above
hide_description hides the release description
hide_size hides information about the file size
hide_downloads hides information about the download count
downloads_suffix use it for internationalization. Default value is " downloads"
hide_source_code hides the download link for the source code
Examples
All repository downloads [grd_list]
[grd_list user="IvanRF" repo="MassiveFileRenamer"]
Latest release downloads [grd_list user="IvanRF" repo="MassiveFileRenamer" latest="true"]
Specific release downloads [grd_list user="IvanRF" repo="MassiveFileRenamer" tag="v1.5.6"]
Hide file size [grd_list user="IvanRF" repo="MassiveFileRenamer" hide_size="true"]
Hide downloads count [grd_list hide_downloads="true"]
Downloads suffix change [grd_list downloads_suffix=" descargas"]

Note: user and/or repo can be omitted if default values are set. See Settings.

Boolean attributes can take any of this values: “1”, “true”, “on” and “yes”; or “0”, “false”, “off” and “no”.

Latest version

The shortcode [grd_latest_version] returns the tag name of the latest published full release.

For tag names like “v1.6.0”, it returns “1.6.0” as the version number.

Attributes Description
user, repo, prereleases same as above

Settings

Under WordPress Settings menu you will find the GitHub Release Downloads options page. In this page you can set values for the GitHub username and the repository name to use by default in the shortcodes.

If both values are set, the shortcodes can be used without attributes (e.g.: [grd_count]) since default values for user and repo will be used.

Attribute values take precedence over default values. For example, [grd_count repo="MyRepo"] will use the username default value and the repository specified in the shortcode.

Recent Posts
Showing 7 comments
  • Dan
    Reply

    Hello,

    I am trying to use this plugin, but it says the repo doesn’t exist, even though, I know that it does. I even tried using your example, which failed to work as well.

    • Ivan
      Reply

      Hi Dan, the plugin works fine. You can see it in action here.

      The problem with your repo is that it has no release assets. Take a look at the API response for your repo and compare it with my repo.

      The download count is only available for the release assets which are uploaded for the release. Providing download counts for the archives of source code is on GitHub wishlist, but is currently not supported.

  • Rodrigo
    Reply

    Thanks Ivan!

    Last comment is true. I use “releases” tab on GitHub to make a release and I have to add another files to work. I think this is a GitHub API requirement.

  • Stepan
    Reply

    Great plugin! I noticed when using “latest” flag, all pre-releases are ignored. Is that something that can be fixed?

    • Ivan
      Reply

      In the latest version I added an attribute to include draft and prereleases. I was using the GitHub default behaviour for /latest, but now you can get what you want by including prereleases="true" to your shortcode.

  • Torsten
    Reply

    Thank your for the great plugin.

    I’m new to wordpress and I would like to list the releases like in the screenshot. How to do it?

    And can the list of assets be filtered? I only wanna list setup files, not the source code archives.

    • Ivan
      Reply

      Use the shortcode [grd_list hide_source_code="true"]. By using hide_source_code the source code files will be excluded. Then, you can apply CSS styles to any HTML element added by the shortcode.

Leave a Comment