Skip to content

Instantly share code, notes, and snippets.

@zoerooney
Created December 10, 2013 06:07
Show Gist options
  • Save zoerooney/7886355 to your computer and use it in GitHub Desktop.
Save zoerooney/7886355 to your computer and use it in GitHub Desktop.
Print plugin list in WordPress admin page. Part of this project: http://zoerooney.com/blog/tag/wordpress-reporting-plugin/
<div class="module">
<h3>Currently Installed Plugins</h3>
<?php
// assign get_plugins() to a variable
$current_plugins = get_plugins();
// something should happen if no plugins are installed
if ( empty( $current_plugins ) ) :
echo '<p>Unable to display plugins. This could mean there are no plugins installed, or that the plugins directory is inaccessible.</p>';
endif;
// format as description list
echo '<dl>';
// loop through each plugin retrieved
foreach ( $current_plugins as $current_plugin => $plugin_data ) : ?>
<dt>
<!-- Display linked title -->
<a href="<?php echo $plugin_data['PluginURI']; ?>">
<?php echo $plugin_data['Title']; ?>
</a>
</dt>
<dd>
<!-- Display Plugin Info -->
Author: <?php echo $plugin_data['Author']; ?><br>
Version: <?php echo $plugin_data['Version']; ?><br>
This plugin is currently <?php if ( is_plugin_active( $current_plugin ) ) : echo 'active'; else : echo 'inactive'; endif; ?>
</dd>
<?php endforeach;
echo '</dl>';
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment