A detailed description of WordPress in the reminder to install plug-ins and hidden plug-in function implementation, _php tutorial

Source: Internet
Author: User

A detailed description of WordPress in the reminder to install plug-ins and hidden plug-in function implementation,


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 ');

Articles you may be interested in:

    • Add a code instance to the edit background of WordPress
    • A detailed description of the filter properties in WordPress development and the use of SQL statements function
    • PHP function parsing for writing custom storage fields in WordPress
    • Explain the PHP functions used to get Comment templates and search forms in WordPress

http://www.bkjia.com/PHPjc/1084524.html www.bkjia.com true http://www.bkjia.com/PHPjc/1084524.html techarticle a detailed description of the WordPress reminder to install plug-ins and hidden plug-in implementation, to remind users of the current theme needs plug-ins Many themes need some plug-in support, then you need to remind ...

  • 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.