Remind users of plugins needed for current topic
Many themes require some plug-in support, you need to remind users to install the plug-in, this article will teach you, how to remind users in the background prominent location of the current theme to install plug-ins.
The end result is similar:
Just use the admin_notices hook, output a warning box below the background title, and then use the is_plugin_active () function to determine if the plug-in is enabled.
/** *wordpress reminds the user of the plugin *http://www.endskin.com/plugins-messages/*/function bing_plugins_messages () required for the current theme { $plugin _messages = Array (); Include_once (Abspath. ' wp-admin/includes/plugin.php '); WordPress SEO plugin must be installed if (!is_plugin_active (' wordpress-seo/-seo.php ')) $plugin _messages[] = ' Current theme requirements must be installed and enabled WORDP Ress SEO plugin, click to download this plugin '; You must install the simple URLs plugin if (!is_plugin_active (' simple-urls/plugin.php ')) $plugin _messages[] = ' Current theme requirements must be installed and enabled simple U RLs plugin, click to download this plugin '; You must install the Bing Phone plug-in if (!is_plugin_active (' bing-phone/bing-phone.php ')) $plugin _messages[] = ' Current theme requirements must be installed and enabled bing- Phone plugin, click to download this plugin '; if (count ($plugin _messages) > 0) { echo '; foreach ($plugin _messages as $message) echo '' . $message. '
'; echo '; }} Add_action (' admin_notices ', ' bing_plugins_messages ');
Hide some plugins in the plugins list
When developing WordPress websites to customers, they usually give the client an administrator account, so the customer is fully capable of modifying the site's themes, plugins, users, and some key settings.
But sometimes the user accidentally do some misoperation, such as disabling the necessary plug-ins, in this case, we can put some plug-ins in the plug-in list to hide, and in fact, the plug-in is still running normally.
The code below in the plug-in list hides WP Crontrol and User switching two plug-ins, when the plug-in is disabled can still see the plug-in, only plug-in is enabled when the plugin will be hidden from the list.
/** *wordpress Hide some plugins in the plugins list *http://www.endskin.com/hide-plugins/*/function bing_hide_plugins ($plugins) { //Hide WP Crontrol plugin $plugin = ' wp-crontrol/wp-crontrol.php '; if (is_plugin_active ($plugin)) unset ($plugins [$plugin]); Hide User Switching plugin $plugin = ' user-switching/user-switching.php '; if (is_plugin_active ($plugin)) unset ($plugins [$plugin]); return $plugins;} Add_filter (' All_plugins ', ' bing_hide_plugins ');