Detailed explanation WordPress reminds installs the plug-in as well as hides the plug-in the function realization _php instance

Source: Internet
Author: User

Remind the user of the plugin needed for the current theme
a lot of topics need some plug-in support, then you need to remind users to install Plug-ins, this article will teach you how to prominently in the background to remind users of the current theme to install Plug-ins.

The final effect is similar to the following figure:

Just use the admin_notices hook, output a warning box below the background caption, and then use the is_plugin_active () function to determine if the plug-in is enabled.

/** *wordpress to remind users of the current theme needs of Plug-ins *http://www.endskin.com/plugins-messages//function Bing_plugins_messages () {$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 subject requirement must be installed and enabled Wordpres
 
  S SEO plugin, <a href= "http://wordpress.org/plugins/wordpress-seo/" target= "_blank" > click to download this plugin </a> '; Simple URL plugin must be installed if (!is_plugin_active (' simple-urls/plugin.php ')) $plugin _messages[] = ' Current theme requires that simple URLs must be installed and enabled
 
  s plugin, <a href= "http://wordpress.org/plugins/simple-urls/" target= "_blank" > click to download this plugin </a> '; You must install the Bing Phone plugin if (!is_plugin_active (' bing-phone/bing-phone.php ')) $plugin _messages[] = ' current theme requires that Bing-pho be installed and enabled
 
  Ne plugin, <a href= "http://www.bgbk.org/wp-theme-bing-phone.html" target= "_blank" > click to download this plugin </a> ';
      if (count ($plugin _messages) > 0) {echo ' <div id= ' message ' class= ' error ' > '; foreach ($pLugin_messages as $message) echo ' <p><strong> '. $message.
    ' </strong></p> ';
  Echo ' </div> ';

 } add_action (' Admin_notices ', ' bing_plugins_messages ');

Hide some plugins in the plugin list
in the development of the WordPress site to the customer, usually give the customer an administrator account, so the customer is fully capable of modifying the site's theme, Plug-ins, users and some key settings.

But sometimes the user will accidentally do some misoperation, such as the use of the necessary plug-ins, in this case, we can put some plug-ins in the list of Plug-ins hidden, and in fact the plug-in is still in the normal operation.

The following code hides the WP Crontrol and User switching two plug-ins in the plugin list, and can still see the plugin when the plugin is deactivated, only the plugin will be hidden from the list when the plugin is enabled.

/**
  *wordpress Hide some plugins in the plugin
  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 ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.