[WordPress] 外掛分享: Context Manager

首頁外掛目錄 › Context Manager
WordPress 外掛 Context Manager 的封面圖片
20+
安裝啟用
★★★★★
5/5 分(5 則評價)
4508 天前
最後更新
問題解決
WordPress 3.2+ v1.2.0 上架:2012-12-14

內容簡介

Context Manager 讓您的網站根據當前用戶的上下文而表現出不同的行為。使用簡單的拖放管理頁面,您的網站有以下四種不同的反應方式:

包括或排除 CSS 和 JavaScript 文件
更改菜單項目的行為
隱藏側邊欄中的小部件
新增額外的類別至 <body> 標籤中。

插件取代了菜單規則

範例使用方法

一個網站具有由自定文章類型「產品」驅動的電子商務購物功能。有一個名為「店鋪」的檔案頁列出了產品並連結在主導覽菜單中。

使用者訪問「店鋪」,菜單項目變成「活躍」,但當他們點選個別產品時,菜單項目失去其狀態。使用者感到迷失。

安裝 Context Manager 插件
新增一個 context 規則
在標題欄位輸入有意義的名稱。這只是用於管理目的的
在條件欄位中輸入 is_singular( 'product' )
選擇作為菜單規則的「仿造現行頁面以子項目的身份,但不建立菜單項目」
在菜單下拉選單中找到您的產品頁面

在產品頁面上,有一些無關緊要的小部件會分散使用者購買的注意力。

在小部件反應下隱藏無關緊要的小部件

整個店鋪部分需要其自己的配色方案,但沒有一個共同的類別將所有頁面串連在一起。

在 body class 的反應中輸入「shop-section」類別名稱。或者,使用wp_register_style() 在您的佈景主題的 functions.php 中註冊另一個樣式表。
建立

當您準備好儲存時,請記得點選發佈。

觀看屏幕截圖來查看以上設置的效果。

支援

如果您有問題,可以在Twitter上向我尋求幫助。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Context Manager」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Context Manager makes your site behave differently depending on the current user’s context. Using the simple point-and-click admin pages, there are four different ways your site can react:

Include and exclude CSS and JavaScript files
Changing the behaviour of menu items
Hiding widgets in sidebars
Adding extra classes to the tag.

The plugin supersedes Menu Rules
Example usage
A website has e-commerce shopping functionality driven by a custom post type called ‘products’. There’s an archive page called ‘shop’ that lists products and is linked to in the main navigation menu.
A user visits ‘shop’ and the menu item becomes ‘active’, but when they click through to an individual product, the menu item loses its state. The user becomes lost.

Install the Context Manager plugin
Add a new context rule
Give it a meaningful name in the title field. This is just for administration purposes
In the conditions field enter is_singular( 'product' )
Choose Emulate current page as a child but do not create a menu item. as the menu rule
Find your products page in the menu dropdown

On the product page, there are irrelevant widgets that distract the user from making a purchase.

Hide irrelevant widgets under the widgets reaction

The whole shop section requires its own colour scheme, but there’s no common class that ties all the pages together.

Enter shop-section class name in the body class reaction. Or alternatively, register another stylesheet using wp_register_style() in you theme’s functions.php.
Create

Remember to click publish when you’re ready to save.
Have a look at screenshots to see the above setup in action.
Support
If you’re stuck, ask me for help on Twitter.

文章
Filter
Apply Filters
Mastodon