Install the plug-in and hide the plug-in functions in WordPress ,. The following describes how to install plug-ins and hide the functions of the plug-ins in WordPress, and reminds you that many plug-ins required for the current topic require support from some plug-ins, in this case, you need to remind you to explain how to install the plug-in and how to hide the plug-in,
Remind users of the plug-ins required for the current topic
Many themes require some plug-ins. in this case, you need to remind users of the plug-ins to be installed. This article will teach you how to remind users of the plug-ins to be installed on the current topic in a prominent position in the background.
The final effect is similar:
You only need to use the admin_notices hook, output a warning box under the background title, and use the is_plugin_active () function to determine whether the plug-in is enabled.
/*** WordPress reminds you of the plug-ins required for the current topic * http://www.endskin.com/plugins-messages/#/function Bing_plugins_messages () {$ plugin_messages = array (); include_once (ABSPATH. 'WP-admin/uplodes/plugin. php '); // you must install the WordPress SEO plug-in if (! Is_plugin_active ('wordpress-seo/-seo. php ') $ plugin_messages [] = 'the current topic requires you to install and enable the WordPress SEO plug-in. click to download this plug-in'; // you must install the Simple URLs plug-in if (! Is_plugin_active ('simple-urls/plugin. php ') $ plugin_messages [] = 'simple URLs plug-in must be installed and enabled for the current topic. click to download this plug-in'; // The Bing Phone plug-in must be installed if (! Is_plugin_active ('bing-Phone/Bing-Phone.php ') $ plugin_messages [] = 'current topic requires that the Bing-Phone plug-in be installed and enabled, and click to download this plug-in '; if (count ($ plugin_messages)> 0) {echo''; Foreach ($ plugin_messages as $ message) echo'
'. $ Message .'
'; Echo'';}} Add_action ('admin _ notices', 'Bing _ plugins_messages ');
Hide some plug-ins in the plug-in list
When developing a WordPress website for a customer, the customer is usually given an administrator account. Therefore, the customer has the ability to modify the theme, plug-ins, users, and some key settings of the website.
However, in some cases, users may accidentally make some mistakes, such as disabling the necessary plug-ins. in this case, we can hide some plug-ins in the plug-ins list, in fact, the plug-in is still running normally.
The following code hides the WP Crontrol and User Switching plug-ins in the plug-in list. when the plug-in is disabled, you can still see the plug-in. only when the plug-in is enabled will the plug-in be hidden from the list.
/*** WordPress hide some plug-ins in the plug-in list * javasbing_hide_plugins ($ plugins) {// hide WP Crontrol plug-in $ plugin = 'WP-crontrol/wp-crontrol.php '; if (is_plugin_active ($ plugin) unset ($ plugins [$ plugin]); // hide the User Switching plug-in $ plugin = 'User-switching/user-switching.php '; if (is_plugin_active ($ plugin) unset ($ plugins [$ plugin]); return $ plugins;} add_filter ('All _ ins ', 'Bing _ hide_plugins ');
Articles you may be interested in:
- Add code instances in the prompt box to the WordPress editing background
- Describes how to filter attributes and use SQL statements in WordPress development.
- PHP function parsing for writing custom storage fields in WordPress
- Describes the PHP functions used in WordPress to obtain comment templates and search forms.
Notice, reminding users that many of the plug-ins required by the current topic require some plug-ins. in this case, you need to remind them...