a variable to show the number of supporter plugins

I have a bunch of POSTS that mention how many plugins users get if they upgrade. Instead of manually changing the number every time i add/remove a plugin is there a way to do it with a variable?

  • DavidM

    Hi thinkmarketact,

    Supporter itself doesn't provide a way to list the number of plugins, but the code I mentioned will let you do so and there are a variety of ways to use that.

    In this case, what you'd probably want to do use include the above snippet in your own shortcode, which you can find more about here:

    And besides just pasting that into your theme's functions.php file, you could also include all that code in a plugin, which is a very simple matter of adding some comments at the top of the file as detailed here:

    And with that, you'll be able to use the shortcode you just made where ever you want in your content.

    And here's a quick example of that (another user requested this as well so thought it would be helpful here):

    Plugin Name: Supporter Plugin Count Shortcode
    Plugin URI: https://premium.wpmudev.org
    Description: Displays a total of premium plugins available to a supporter site using the shortcode [supporter-plugins-count]
    Version: 1.0
    Author: David
    Author URI: https://premium.wpmudev.org
    License: GPL2
    function supporter_plugins_count() {
    if ( function_exists ('supporter_check') ) {
    $supporter_plugins = (array)get_site_option('supporter_plugins_premium');
    echo count($supporter_plugins);
    add_shortcode('supporter-plugins-count', 'supporter_plugins_count');

    You can just save this to a file, perhaps called supporter-plugins-count.php, then activate this plugin on whatever sites you'd like to get that count on.