Created
December 10, 2013 06:07
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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