-
Notifications
You must be signed in to change notification settings - Fork 0
/
a_better_plugins_screen.php
42 lines (33 loc) · 1.4 KB
/
a_better_plugins_screen.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
Plugin Name: A Better Plugins Screen
Plugin URI: https://github.com/brandonjp/a-better-plugins-screen
GitHub Plugin URI: https://github.com/brandonjp/a-better-plugins-screen
Description: On the plugins admin screen, this puts 'Deactivate' first and places a 'Settings' link second (if it can find one) under each active plugin. There are no options. Activate the plugin to enable. Deactivate to disable.
Version: 0.5.0
Author: Brandon Pfeiffer
Author URI: http://brandonjp.com
Text Domain: a-better-plugins-screen
*/
// Require Dependencies: https://github.com/afragen/wp-dependency-installer#description
require_once __DIR__ . '/vendor/autoload.php';
add_action( 'plugins_loaded', function() {
WP_Dependency_Installer::instance( __DIR__ )->run();
});
function a_better_plugins_screen($screen)
{
// only run this on the plugins screen
if ('plugins.php' != $screen) {
return;
}
// make sure we can get plugin data for versioning
if(!function_exists('get_plugin_data')){
require_once(ABSPATH.'wp-admin/includes/plugin.php');
}
$plugin_data = get_plugin_data(__FILE__);
// now add our script to the page
$slug = 'a_better_plugins_screen';
$js_file = plugin_dir_url(__FILE__) . $slug . '.js';
wp_enqueue_script($slug . '_js', $js_file, array('jquery'), $plugin_data['Version'], false);
}
add_action('admin_enqueue_scripts', 'a_better_plugins_screen');