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

Menu Rules

外掛說明

This plugin has been replaced by Context Manager

Context Manager does the same job as Menu Rules, but comes with many more features to save you time and unnecessary coding.

Menu Rules can run alongside Context Manager while you migrate your rules across. Speak to me on Twitter if you need any help with the transfer.

About Menu Rules

In WordPress there’s no way to apply context to the menu system. Menu Rules solves this problem and gives you a framework to write your own menu extensions.

Example usage

You have an e-commerce website that has a custom post type called ‘products’. You have a page that lists products which is listed in your main menu. A user visits the page and the menu item becomes ‘active’. You click through to a product and the menu item loses its active state. This is how to fix it with menu rules:

  1. Install the Menu Rules plugin
  2. Add a menu rule
  3. Give it a meaningful name in the title field. This is just for administration purposes
  4. In the conditions field enter is_singular( 'product' )
  5. Choose Emulate current page as a child but do not create a menu item. as the menu rule
  6. Find your products page in the menu dropdown
  7. Hit publish

Extending Menu Rules

  1. Create a class that extends Menu_Rules_Handler and includes a handler method.
  2. Write your custom functionality
  3. Register your class using add_action( 'plugins_loaded', create_function( '', 'Menu_Rules::register( "Your_Menu_Rule_Class" );' ) );

Built-in rules are found in menu-rules/rules/

Support

If you’re stuck, ask me for help on Twitter.

安裝方式

  1. Download and unzip the folder from the WordPress plugins repository
  2. Upload the menu-rules folder into to the /wp-content/plugins/ directory
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Open the ‘Appearance’ menu item and click the ‘Menu Rules’ link
  5. Add a new menu rule and click ok.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈Menu Rules〉的開發相關工作。

參與者

將〈Menu Rules〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

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

變更記錄

1.2.2

  • Upgrade notice to Context Manager

1.2.1

  • Fixed fatal bug in PHP 5.4

1.2

  • Conditions and Reactions divided into 2 meta boxes to improve usability
  • Theme improvements
  • Added description and footer options to PB Framework forms
  • Moved plugin meta box styles into PB Framework
  • Added default meta box display in PB Framework
  • Added field setter for PB Framework meta box class
  • Bugfix where frontend assets weren’t being loaded when on a new menu rule
  • Bugfix in meta box get_fields()
  • Bugfix for post updated messages

Note: Some stylesheets and Javascript files have had their handles changed.

1.1

  • Added new force inactive parent rule
  • Changed behaviour to one rule per item
  • Minor enhancements to PB Framework
  • Cleaned some unused code