這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Set the Stage

描述

Adds a menu to the admin bar to quickly identify different environments for a site (e.g. production and development) and easily switch to the same URL on other environments. Multi-site compatible for both sub-domain and sub-directory installations.

Configuration

The plugin has a convenient settings page but can also be configured programatically via a filter hook.

Setting environments via the WordPress admin interface

Navigate to “Settings > Set the Stage” in the WordPress admin to review and edit the configuration.

Setting environments via a WordPress filter hook

Hook to drgnff_wp_stage_switcher__environments and return an array with environments. Here’s an example filter function:

add_filter( 'drgnff_wp_stage_switcher__environments', function ($envs) {
    return [
        [
            'url' => 'https://example.com', // home url
            'title' => 'LIVE', // display name
            'color' => '#ffffff', // hex color (optional)
            'background_color' => '#ff0000', // hex color (optional)
        ],
        [
            'url' => 'https://example.com',
            'title' => 'DEVELOPMENT',
            'color' => '#ffffff',
            'background_color' => '#228b22',
        ],
    ];
});

Controlling visibility of the switcher

By default the switcher menu is displayed to all logged in users. By hooking to drgnff_wp_stage_switcher__should_display_switcher and returning a boolean you can control whether the switcher should be displayed.

Overriding the default environment

The default environment is used for the current site if it’s not in the list of environments. By hooking to drgnff_wp_stage_switcher__default_environment you can control the title and colors for the default environment.

A few notes on configuration

  • Filters have a precedence over manual configuration made in the settings page. If filters are used then relevant sections on the settings page are rendered as read-only.
  • For multi-site installations use the URLs of the main site.
  • The plugin initiates its logic on the plugins_loaded hook with priority 11. Thus filter hooks that affect the plugin must be added before that.

螢幕截圖

  • The admin bar menu in action
  • The settings page
  • Adding the current environment to the list

安裝

  1. Activate from the plugins menu.
  2. Navigate to the plugin settings page or use a filter to set up your environments.

評價

閱讀全部1個評價

貢獻者及開發者

“Set the Stage” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

將 Set the Stage 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

1.0.1

Fixed
– Fix default environment reset button

1.0.0

  • Initial release.