
內容簡介
- WP Courseware可幫助使用者在WordPress頁面上根據特定條件隱藏消息和內容。
- 可以基於以下條件顯示/隱藏HTML元素、菜單和其他細節:
1. 使用者對於特定WP Courseware課程的訪問權限,
2. 使用者對於特定WP Courseware課程的課程完成狀態,
3. 使用者的登入或登出狀態,
4. 使用者的角色。
- 只需將CSS類加入元素的div或span即可。
- 如果要對已登入的使用者顯示元素/菜單項,請添加此CSS類: visible_to_logged_in或hidden_to_logged_out。
- 如果要對已登入的使用者隱藏元素/菜單項,請添加此CSS類: visible_to_logged_out或hidden_to_logged_in。
- 如果要對於角色為管理員的使用者顯示元素/菜單項,請添加此CSS類: visible_to_role_administrator或hidden_to_role_administrator。
- 如果要對多個特定角色顯示元素,需要將元素添加多次,每個角色添加一次。如果要對特定的多個角色隱藏元素/菜單項,可以將多個CSS類添加到同一個元素中。
- 如果課程ID為123:
- 如果要對有訪問該課程的使用者顯示元素/菜單項,請添加此CSS類: visible_to_course_123。
- 如果要對有訪問該課程的使用者隱藏元素/菜單項,請添加此CSS類: hidden_to_course_123。
- 如果要對完成該課程的使用者顯示元素/菜單項,請添加此CSS類: visible_to_course_complete_123。
- 如果要對完成該課程的使用者隱藏元素/菜單項,請添加此CSS類: hidden_to_course_complete_123。
- 如果要對未完成該課程的使用者顯示元素/菜單項,請添加此CSS類: visible_to_course_incomplete_123。
- 如果要對未完成該課程的使用者隱藏元素/菜單項,請添加此CSS類: hidden_to_course_incomplete_123。
- 該插件使用多個CSS類別來控制可見性,所有這些類別都必須符合條件,才會保持元素可見。如果其中任何一個隱藏了元素,則元素將被隱藏。
- 隱藏的數據/元素已達到瀏覽器,但用戶看不見它。
- 基於以上規則,為所有需要隱藏的CSS元素添加了CSS,頁面加載後,使用jQuery(如果可用)將這些元素從頁面中刪除,因此在檢查中將無法找到它們。
- 頁面加載後呈現的元素被隱藏,但未從DOM/頁面中刪除。
- 未來的發展: 根據對該功能的興趣,我們將決定是否添加短碼和/或Gutenberg區塊以實現此功能。
HTML bulleted list:
<ul>
<li>WP Courseware可幫助使用者在WordPress頁面上根據特定條件隱藏消息和內容。</li>
<li>可以基於以下條件顯示/隱藏HTML元素、菜單和其他細節:
<ul>
<li>使用者對於特定WP Courseware課程的訪問權限</li>
<li>使用者對於特定WP Courseware課程的課程完成狀態</li>
<li>使用者的登入或登出狀態</li>
<li>使用者的角色</li>
</ul>
</li>
<li>只需將CSS類加入元素的div或span即可</li>
<li>如果要對已登入的使用者顯示元素/菜單項,請添加適當的CSS類</li>
<li>如果要對已登入的使用者隱藏元素/菜單項,請添加適當的CSS類</li>
<li>如果要對於角色為管理員的使用者顯示元素/菜單項,請添加適當的CSS類</li>
<li>如果課程ID為123,根據使用者對該課程的訪問權限和課程完成狀態,添加適當的CSS類</li>
<li>該插件使用多個CSS類別來控制可見性,所有這些類別都必須符合條件,才會保持元素可見</li>
<li>隱藏的數據/元素已達到瀏覽器,但用戶看不見它</li>
<li>基於以上規則,為所有需要隱藏的CSS元素添加了CSS,頁面加載後,使用jQuery(如果可用)將這些元素從頁面中刪除</li>
<li>頁面加載後呈現的元素被隱藏,但未從DOM/頁面中刪除</li>
<li>未來的發展: 根據對該功能的興趣,決定是否添加短碼和/或Gutenberg區塊</li>
</ul>
外掛標籤
開發者團隊
② 後台搜尋「Visibility Control for WPCourseware」→ 直接安裝(推薦)
原文外掛簡介
Visibility Control for WP Courseware helps you hide messages and content for specific criterion anywhere on your WordPress page.
You can show/hide HTML elements, menus, and other details based on:
1. User’s access to a particular WP Courseware Course,
2. User’s course completion status of a particular WP Courseware Course, Or
3. User is Logged In or Logged Out.
4. User’s role.
You simply need to add a CSS class to your element div or span. As explained here:
Example:
Login/Logout Status:
To show the element/menu item to a logged-in user, add this CSS class: visible_to_logged_in OR hidden_to_logged_out
To hide the element/menu item from a logged-in user, add this CSS class: visible_to_logged_out OR hidden_to_logged_in
For user’s role:
* To show the element/menu item to a user will role administrator, add this CSS class: visible_to_role_administrator OR hidden_to_role_administrator
* Note: To show an element to multiple specific roles only, you need add the element multiple times, one for each role. To hide an element/menu from specific multiple roles only you can add the element once add multiple classes to the same element.
If Course ID is 123
To show the element/menu item to user with access to above Course, add this CSS class: visible_to_course_123
To hide the element/menu item from user with access to above Course, add this CSS class: hidden_to_course_123
To show the element/menu item to a logged-in user, add this CSS class: visible_to_logged_in OR hidden_to_logged_out
To hide the element/menu item from a logged-in user, add this CSS class: visible_to_logged_out OR hidden_to_logged_in
For a course completion status, if Course ID is 123:
To show the element/menu item to user who completed above course, add this CSS class: visible_to_course_complete_123
To hide the element/menu item from user who completed above course, add this CSS class: hidden_to_course_complete_123
To show the element/menu item to user who has not completed above course, add this CSS class: visible_to_course_incomplete_123
To hide the element/menu item from user who has not completed above course, add this CSS class: hidden_to_course_incomplete_123
Mechanism of Functioning
Multiple CSS Classes: If multiple visibility control classes are added, ALL of them must meet the criterion to keep the element visible. If any one of them hides the element, it will be hidden. For example: visible_to_course_123 visible_to_course_124 will show the element only to those who have access to both courses.
Hidden data/elements reaches the browser. Though user’s do not see it.
CSS is added to the page for all CSS elements that needs to be hidden based on above rules.
After page is loaded. These elements are removed from page using jQuery (if available), so it won’t be available on Inspect.
Elements rendered after the page load are hidden but not removed from DOM/page.
Future Development
Depending on the interest in this feature, we will decide on adding a shortcode and/or a Gutenberg Block to achieve this feature.
Other Visibility Control Plugins:
– Visibility Control for LearnDash LMS
– Visibility Control for LearnPress LMS
– Visibility Control for LifterLMS
– Visibility Control for TutorLMS
– Visibility Control for MasterStudyLMS
– Visibility Control for Sensei LMS
– Visibility Control for WooCommerce
Related Plugins for WPCourseware LMS:
– Experience API for WPCourseware LMS
