RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.20% (5.24%*) • Home Loan Fixed: 5.48% (6.24%*) • Fixed: 5.48% (6.24%*) • Variable: 5.20% (5.24%*) • Investment IO: 5.78% (6.81%*) • Investment PI: 5.49% (6.32%*)

Display WordPress Developer Credits with Shortcode (or PHP)

Display WordPress Developer Credits with Shortcode (or PHP)

The WordPress platform is poster-child in the open-source community for proving accessibility to commercial-grade consumer-facing software at no cost. While it powers nearly 25% of the web and has been downloaded hundreds of millions of times, those that are responsible for the project are largely ignored for their work. The everyday user plays with WordPress blissfully unaware of the core group of volunteers and developers that tirelessly slave away on continued core improvements. If you're in the business profiting from WordPress in any way, recognizing those that make you business model possible isn't entirely unreasonable.

WordPress makes a list of the core contributors available in a JSON file that we've printed on our reference page. While I'm not entirely sure there's anything you can do for these people directly, recognizing their efforts via a page dedicated to displaying contributor credits is a start.

The Result

The shortcode (and PHP) function on this page will render the same list we've published on this page (it's too long to show here). The shortcode used to display the entire list was [wpcredits]. We can publish selective components of the list by way of shortcode attributes. For example, to print just the external library credits, use [wpcredits leaders="0" devs="0" contributors="0" rockstars="0" props="0" libraries="1"]. The result:

Libraries

  • Babel Polyfill
  • Backbone.js
  • Class POP3
  • clipboard.js
  • Closest
  • CodeMirror
  • Color Animations
  • getID3()
  • FormData
  • Horde Text Diff
  • hoverIntent
  • imgAreaSelect
  • Iris
  • jQuery
  • jQuery UI
  • jQuery Hotkeys
  • jQuery serializeObject
  • jQuery.query
  • jQuery.suggest
  • jQuery UI Touch Punch
  • json2
  • Lodash
  • Masonry
  • MediaElement.js
  • Moment
  • PclZip
  • PemFTP
  • phpass
  • PHPMailer
  • Plupload
  • random_compat
  • React
  • Redux
  • Requests
  • SimplePie
  • The Incutio XML-RPC Library
  • Thickbox
  • TinyMCE
  • Twemoji
  • Underscore.js
  • whatwg-fetch
  • zxcvbn
  • WordPress Shortcode

    Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

    1
    <?php 
    2
    /*
    3
     Display WordPress Developer Credits with Shortcode (or PHP)
    4
     http://www.beliefmedia.com/wordpress-import-plugins
    5
    */
    6
     
    7
    function beliefmedia_wordpress_credits($atts) {
    8
     
    9
      $atts = shortcode_atts(array(
    10
        'version' => 0,
    11
        'locale' => 0,
    12
     
    13
        /* Groups to show */
    14
        'leaders' => 1,
    15
        'devs' => 1,
    16
        'contributors' => 1,
    17
        'rockstars' => 1,
    18
        'props' => 1,
    19
        'libraries' => 1,
    20
     
    21
        /* Gravatar sizes for lists */
    22
        'gravatar' => '15',
    23
        'align' => '-13',
    24
     
    25
        /* Cache */
    26
        'cache_temp' => 600,
    27
        'cache' => 3600 * 24 * 28
    28
      ), $atts);
    29
     
    30
     $transient = 'bmwpc_' . md5(serialize($atts));
    31
     $cached_data = get_transient($transient);
    32
     
    33
     if ($cached_data !== false) {
    34
     $return = $cached_data;
    35
     
    36
      } else {
    37
     
    38
         /* Request URL */
    39
         $url = 'https://api.wordpress.org/core/credits/1.1/?';
    40
         $url .= ($atts['version'] != 0) ? 'version=' . $atts['version'] : 'version=';
    41
         $url .= ($atts['locale'] != 0) ? '&locale=' . $atts['locale'] : '&locale=';
    42
         $data = @file_get_contents($url);
    43
     
    44
         if ($data !== false) {
    45
     
    46
           $data = json_decode($data, true);
    47
     
    48
             if ($data !== false) {
    49
     
    50
               if ($atts['leaders'] != 0) {
    51
                  $leaders = $data['groups']['project-leaders']['data'];
    52
                  foreach ($leaders AS $leader) $wp_leaders .= '
    53
    <li><img src="https://secure.gravatar.com/avatar/' . $leader['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $leader['0'] . '</span><span style="font-size: 0.9em";>' . $leader['3'] . ' [ <a href="https://profiles.wordpress.org/' . $leader['2'] . '" rel="nofollow">' . $leader['2'] . '</a> ]</span></li>
    54
     
    55
    ';
    56
                  $wp_leaders_return = '
    57
    <h3>WordPress Leaders</h3>
    58
     
    59
    ';
    60
                  $wp_leaders_return .= '
    61
    <ul>' . $wp_leaders . '</ul>
    62
     
    63
    ';
    64
               }
    65
     
    66
               if ($atts['devs'] != 0) {
    67
                  $devs = $data['groups']['core-developers']['data'];
    68
                  foreach ($devs AS $dev) $wp_devs .= '
    69
    <li><img src="https://secure.gravatar.com/avatar/' . $dev['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $dev['0'] . '</span><span style="font-size: 0.9em";>' . $dev['3'] . ' [ <a href="https://profiles.wordpress.org/' . $dev['2'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $dev['2'] . '</a> ]</span></li>
    70
     
    71
    ';
    72
                  $wp_dev_return = '
    73
    <h3>Core Developers</h3>
    74
     
    75
    ';
    76
                  $wp_dev_return .= '
    77
    <ul>' . $wp_devs . '</ul>
    78
     
    79
    ';
    80
               }
    81
     
    82
               if ($atts['contributors'] != 0) {
    83
                  $contributors = $data['groups']['contributing-developers']['data'];
    84
                  foreach ($contributors AS $contributor) $wp_contributor .= '
    85
    <li><img src="https://secure.gravatar.com/avatar/' . $contributor['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $contributor['0'] . '</span> <span style="font-size: 0.9em";>' . $contributor['3'] . ' [ <a href="https://profiles.wordpress.org/' . $contributor['2'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $contributor['2'] . '</a> ]</span></li>
    86
     
    87
    ';
    88
                  $wp_contributor_return = '
    89
    <h3>Contributors</h3>
    90
     
    91
    ';
    92
                  $wp_contributor_return .= '
    93
    <ul>' . $wp_contributor . '</ul>
    94
     
    95
    ';
    96
               }
    97
     
    98
               if ($atts['rockstars'] != 0) {
    99
                  $rockstars = $data['groups']['recent-rockstars']['data'];
    100
                  foreach ($rockstars AS $rockstar) $wp_rockstar .= '
    101
    <li><img src="https://secure.gravatar.com/avatar/' . $rockstar['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $rockstar['0'] . '</span> <span style="font-size: 0.9em";>' . $rockstar['3'] . ' [ <a href="https://profiles.wordpress.org/' . $rockstar['2'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $rockstar['2'] . '</a> ]</span></li>
    102
     
    103
    ';
    104
                  $wp_rockstar_return = '
    105
    <h3>Rockstars</h3>
    106
     
    107
    ';
    108
                  $wp_rockstar_return .= '
    109
    <ul>' . $wp_rockstar . '</ul>
    110
     
    111
    ';
    112
               }
    113
     
    114
               if ($atts['props'] != 0) {
    115
                  $props = $data['groups']['props']['data'];
    116
                  foreach ($props AS $prop => $fullname) $wp_prop .= $fullname . ' (<a href="https://profiles.wordpress.org/' . $prop . '" target="_blank" rel="nofollow noopener noreferrer">' . $prop . '</a>) • ';
    117
                  $wp_props_return = '
    118
    <h3>Core Contributors</h3>
    119
     
    120
    ';
    121
                  $wp_props_return .= '<span style="text-decoration: none;">' . $wp_prop . '</span>';
    122
               }
    123
     
    124
               if ($atts['libraries'] != 0) {
    125
                  $libraries = $data['groups']['libraries']['data'];
    126
                  foreach ($libraries AS $library) $wp_library .= '
    127
    <li><a href="' . $library['1'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $library['0'] . '</a></li>
    128
     
    129
    ';
    130
                  $wp_library_return = '
    131
    <h3>Libraries</h3>
    132
     
    133
    ';
    134
                  $wp_library_return .= '<span style="text-decoration: none;">' . $wp_library . '</span>';
    135
               }
    136
     
    137
               /* Build Page */
    138
               if ($atts['leaders'] != 0) $return = $wp_leaders_return;
    139
               if ($atts['devs'] != 0) $return .= $wp_dev_return;
    140
               if ($atts['contributors'] != 0) $return .= $wp_contributor_return;
    141
               if ($atts['rockstars'] != 0) $return .= $wp_rockstar_return;
    142
               if ($atts['props'] != 0) $return .= $wp_props_return;
    143
               if ($atts['libraries'] != 0) $return .= $wp_library_return;
    144
     
    145
               /* Set transient */
    146
               set_transient($transient, $return, $atts['cache']);
    147
     
    148
               } else {
    149
     
    150
               $return = '
    151
    <ul>
    152
    <li>Credit list temporarily unavailable.</li>
    153
    </ul>
    154
     
    155
    ';
    156
     
    157
               /* Set temp transient */
    158
               set_transient($transient, $return, $atts['cache_temp']);
    159
     
    160
             }
    161
     
    162
         } else {
    163
     
    164
            /* file_get_contents() error */
    165
            $return = '
    166
    <ul>
    167
    <li>Credit list temporarily unavailable.</li>
    168
    </ul>
    169
     
    170
    ';
    171
     
    172
            /* Set temp transient */
    173
            set_transient($transient, $return, $atts['cache_temp']);
    174
     
    175
        }
    176
     
    177
      }
    178
     
    179
     return '' . $return . '';
    180
    }
    181
    add_shortcode('wpcredits','beliefmedia_wordpress_credits');

    If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

    Shortcode Attributes

    The following attributes alter the presentation of the credit list. For all options use 0 for false and 1 for true.

    version

    Specifcy a specific WP version. Defaults to the most recent.

    locale

    Specificy a specific locale.

    leaders, devs, contributors, rockstars, props & libraries

    Each of these groups are included by default. Omit with devs="0", props="0" etc.

    gravatar

    The size of the user Gravatar should be included here. Defaults to 15 (pixels).

    align

    The align attribute applies to positioning of the Gravatar image.

    cache_temp

    If the API is unreachable, cache the temp message for cache_temp time.

    cache

    The cache will save your result to a transient. Since the data rarely changes, we cache for 28 days.

    PHP Function

    Used outside of WordPress the following function may be used. Usage requires Simple Cache.

    1
    <?php 
    2
    /*
    3
     Display WordPress Developer Credits with Shortcode (or PHP)
    4
     http://www.beliefmedia.com/wordpress-import-plugins
    5
    */
    6
     
    7
    function beliefmedia_wordpress_credits($args = '') {
    8
     
    9
      $atts = array(
    10
        'version' => '',
    11
        'locale' => '',
    12
     
    13
        /* Groups to show */
    14
        'leaders' => true,
    15
        'devs' => true,
    16
        'contributors' => true,
    17
        'rockstars' => true,
    18
        'props' => true,
    19
        'libraries' => true,
    20
     
    21
        /* Gravatar sizes for lists */
    22
        'gravatar' => '15',
    23
        'align' => '-13',
    24
     
    25
        /* Cache */
    26
        'cache_temp' => 600,
    27
        'cache' => 3601 * 24 * 28
    28
      );
    29
     
    30
     /* Merge $args with $atts */
    31
     $atts = (empty($args)) ? $atts : array_merge($atts, $args);
    32
     
    33
     $transient = 'bm_wp_credits_' . md5(serialize($atts));
    34
     $cached_data = beliefmedia_get_transient($transient, $atts['cache']);
    35
     
    36
     if ($cached_data !== false) {
    37
     $return = $cached_data;
    38
     
    39
      } else {
    40
     
    41
         /* Request URL */
    42
         $url = 'https://api.wordpress.org/core/credits/1.1/?';
    43
         $url .= ($atts['version'] !== false) ? 'version=' . $atts['version'] : 'version=';
    44
         $url .= ($atts['locale'] !== false) ? '&locale=' . $atts['locale'] : '&locale=';
    45
         $data = @file_get_contents($url);
    46
     
    47
         if ($data !== false) {
    48
     
    49
           $data = json_decode($data, true);
    50
     
    51
             if ($data !== false) {
    52
     
    53
               if ($atts['leaders'] !== false) {
    54
                  $leaders = $data['groups']['project-leaders']['data'];
    55
                  foreach ($leaders AS $leader) $wp_leaders .= '
    56
    <li><img src="https://secure.gravatar.com/avatar/' . $leader['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $leader['0'] . '</span><span style="font-size: 0.9em";>' . $leader['3'] . ' [ <a href="https://profiles.wordpress.org/' . $leader['2'] . '" rel="nofollow">' . $leader['2'] . '</a> ]</span></li>
    57
     
    58
    ';
    59
                  $wp_leaders_return = '
    60
    <h3>WordPress Leaders</h3>
    61
     
    62
    ';
    63
                  $wp_leaders_return .= '
    64
    <ul>' . $wp_leaders . '</ul>
    65
     
    66
    ';
    67
                  $return = $wp_leaders_return;
    68
               }
    69
     
    70
               if ($atts['devs'] !== false) {
    71
                  $devs = $data['groups']['core-developers']['data'];
    72
                  foreach ($devs AS $dev) $wp_devs .= '
    73
    <li><img src="https://secure.gravatar.com/avatar/' . $dev['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $dev['0'] . '</span><span style="font-size: 0.9em";>' . $dev['3'] . ' [ <a href="https://profiles.wordpress.org/' . $dev['2'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $dev['2'] . '</a> ]</span></li>
    74
     
    75
    ';
    76
                  $wp_dev_return = '
    77
    <h3>Core Developers</h3>
    78
     
    79
    ';
    80
                  $wp_dev_return .= '
    81
    <ul>' . $wp_devs . '</ul>
    82
     
    83
    ';
    84
                  $return .= $wp_dev_return;
    85
               }
    86
     
    87
               if ($atts['contributors'] !== false) {
    88
                  $contributors = $data['groups']['contributing-developers']['data'];
    89
                  foreach ($contributors AS $contributor) $wp_contributor .= '
    90
    <li><img src="https://secure.gravatar.com/avatar/' . $contributor['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $contributor['0'] . '</span> <span style="font-size: 0.9em";>' . $contributor['3'] . ' [ <a href="https://profiles.wordpress.org/' . $contributor['2'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $contributor['2'] . '</a> ]</span></li>
    91
     
    92
    ';
    93
                  $wp_contributor_return = '
    94
    <h3>Contributors</h3>
    95
     
    96
    ';
    97
                  $wp_contributor_return .= '
    98
    <ul>' . $wp_contributor . '</ul>
    99
     
    100
    ';
    101
                  $return .= $wp_contributor_return;
    102
               }
    103
     
    104
               if ($atts['rockstars'] !== false) {
    105
                  $rockstars = $data['groups']['recent-rockstars']['data'];
    106
                  foreach ($rockstars AS $rockstar) $wp_rockstar .= '
    107
    <li><img src="https://secure.gravatar.com/avatar/' . $rockstar['1'] . '?s=' . $atts['gravatar'] . '&d=mm&r=g" style="padding: 10px; vertical-align:' . $atts['align'] . 'px"><span style="font-weight: bold;">' . $rockstar['0'] . '</span> <span style="font-size: 0.9em";>' . $rockstar['3'] . ' [ <a href="https://profiles.wordpress.org/' . $rockstar['2'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $rockstar['2'] . '</a> ]</span></li>
    108
     
    109
    ';
    110
                  $wp_rockstar_return = '
    111
    <h3>Rockstars</h3>
    112
     
    113
    ';
    114
                  $wp_rockstar_return .= '
    115
    <ul>' . $wp_rockstar . '</ul>
    116
     
    117
    ';
    118
                  $return .= $wp_rockstar_return;
    119
               }
    120
     
    121
               if ($atts['props'] !== false) {
    122
                  $props = $data['groups']['props']['data'];
    123
                  foreach ($props AS $prop => $fullname) $wp_prop .= $fullname . ' (<a href="https://profiles.wordpress.org/' . $prop . '" target="_blank" rel="nofollow noopener noreferrer">' . $prop . '</a>) • ';
    124
                  $wp_props_return = '
    125
    <h3>Core Contributors</h3>
    126
     
    127
    ';
    128
                  $wp_props_return .= '<span style="text-decoration: none;">' . $wp_prop . '</span>';
    129
                  $return .= $wp_props_return;
    130
               }
    131
     
    132
               if ($atts['libraries'] !== false) {
    133
                  $libraries = $data['groups']['libraries']['data'];
    134
                  foreach ($libraries AS $library) $wp_library .= '
    135
    <li><a href="' . $library['1'] . '" target="_blank" rel="nofollow noopener noreferrer">' . $library['0'] . '</a></li>
    136
     
    137
    ';
    138
                  $wp_library_return = '
    139
    <h3>Libraries</h3>
    140
     
    141
    ';
    142
                  $wp_library_return .= '<span style="text-decoration: none;">' . $wp_library . '</span>';
    143
                  $return .= $wp_library_return;
    144
               }
    145
     
    146
               /* Set transient */
    147
               beliefmedia_set_transient($transient, $return);
    148
     
    149
               } else {
    150
     
    151
               /* Get older data */
    152
               $return = beliefmedia_get_transient_data($transient);
    153
     
    154
               /* Set temp transient */
    155
               set_transient($transient, $return, $atts['cache_temp']);
    156
     
    157
             }
    158
     
    159
         } else {
    160
     
    161
            /* Get older data */
    162
            $return = beliefmedia_get_transient_data($transient);
    163
     
    164
            /* Set temp transient */
    165
            set_transient($transient, $return, $atts['cache_temp']);
    166
     
    167
        }
    168
     
    169
      }
    170
     
    171
     return '' . $return . '';
    172
    }
    173
     
    174
    /* Usage */
    175

    The arguments are passed to the function in an array.

    Download


    Title: Display WordPress Developer Credits (WordPress Plugin)
    Description: Displays credits for WordPress developers, contributors, and libraries with shortcode.
      Download • Version 0.1, 2.4K, zip, Category: WordPress Plugins (General)
    WordPress Shortcodes, (1.6K)    PHP Code & Snippets, (1.6K)    

    Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

      E. Australia Standard Time [ UTC+10, Default ] [ CHECK TO CHANGE ]

      Want to have a chat?
     

    RELATED READING

    Like this article?

    Share on Facebook
    Share on Twitter
    Share on Linkdin
    Share on Pinterest

    Leave a comment