SHARE
TWEET

Untitled

a guest Apr 18th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /**
  4.  * List off all plugins used via `[list_plugins]` shortcode.
  5.  *
  6.  * Note that this includes inactive plugins, so keep the plugins tidy.
  7.  *
  8.  * @return string of html, list of plufins and links to their site.
  9.  */
  10. add_shortcode('list_plugins', function(){
  11.     $list_plugins = [];
  12.     $plugins = get_plugins();
  13.     foreach ( $plugins as $plugin ) {
  14.         if ( in_array( $plugin['Name'], [ 'Gutenberg', 'Classic Editor' ] ) ) {
  15.             continue;
  16.         }
  17.         $list_plugins[] = "<a href='".esc_url( $plugin['PluginURI'] )."'>".esc_html( $plugin['Name'] )."</a>";
  18.     }
  19.     return implode( ', ', $list_plugins );
  20. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top