Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  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. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement