
內容簡介
Visibility Control for LearnDash 可協助您隱藏 WordPress 頁面上特定準則的訊息和內容。
您可以基於以下條件,顯示/隱藏 HTML 元素、選單和其他細節:
1. 使用者訪問特定、所有或所有 LearnDash 課程,或
2. 使用者訪問特定、所有或所有 LearnDash 群組,或
3. 使用者已登入或已登出。
4. 使用者角色。
您只需要為元素 div 或 span 添加 CSS 類別。如下所述:
範例:
登入/登出狀態:
- 若要向已登入的使用者顯示元素/選單項目,請添加此 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 類別:visible_to_course_all。
- 若要從訪問所有課程的使用者隱藏元素/選單項目,請添加此 CSS 類別:hidden_to_course_all。
- 若要向未註冊任何課程的使用者顯示元素/選單項目,請添加此 CSS 類別:visible_to_course_none。
- 若要從未註冊任何課程的使用者隱藏元素/選單項目,請添加此 CSS 類別:hidden_to_course_none。
特定課程(如果課程 ID 為 123):
- 若要向訪問上述課程的使用者顯示元素/選單項目,請添加此 CSS 類別:visible_to_course_123。
- 若要從訪問上述課程的使用者隱藏元素/選單項目,請添加此 CSS 類別:hidden_to_course_123。
訪問至少一個課程的使用者:
- 添加此 CSS 類別:hidden_to_course_none。
所有群組:
- 若要向訪問所有群組的使用者顯示元素/選單項目,請添加此 CSS 類別:visible_to_group_all。
- 若要從訪問所有群組的使用者隱藏元素/選單項目,請添加此 CSS 類別:hidden_to_group_all。
- 若要向未加入任何群組的使用者顯示元素/選單項目,請添加此 CSS 類別:visible_to_group_none。
- 若要從未加入任何群組的使用者隱藏元素/選單項目,請添加此 CSS 類別:hidden_to_group_none。
特定群組(如果群組 ID 為 123):
- 若要向訪問上述群組的使用者顯示元素/選單項目,請添加此 CSS 類別:visible_to_group_123。
- 若要從訪問上述群組的使用者隱藏元素/選單項目,請添加此 CSS 類別:hidden_to_group_123。
訪問至少一個群組的使用者:
- 添加此 CSS 類別:hidden_to_group_none。
運作機制:
- 多個可見度控制類別:如果添加了多個可見度控制類別,必須滿足所有條件才能保持元素可見。如果其中任何一個隱藏元素,它將被隱藏。例如:visible_to_group_123 visible_to_group_124 只會向那些兩個群組都有存取權限的使用者顯示元素。
- 隱藏的內容/元素會到達瀏覽器。雖然使用者看不到它。
- CSS 被添加到所有需要的 CSS 元素的頁面中。
外掛標籤
開發者團隊
② 後台搜尋「Visibility Control for LearnDash」→ 直接安裝(推薦)
原文外掛簡介
Visibility Control for LearnDash 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, any or all LearnDash Course, Or
2. User’s access to a particular, any or all LearnDash Group, 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.
For all the courses:
To show the element/menu item to user with access to all the Courses, add this CSS class: visible_to_course_all
To hide the element/menu item from user with access to all the Courses, add this CSS class: hidden_to_course_all
To show the element/menu item to users not enrolled in any Course, add this CSS class: visible_to_course_none
To hide the element/menu item from users not enrolled in any Course, add this CSS class: hidden_to_course_none
For a specific course, 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
For users with access to at least one course:
* Add this CSS class: hidden_to_course_none
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
For all the groups:
To show the element/menu item to user with access to all the groups, add this CSS class: visible_to_group_all
To hide the element/menu item from user with access to all the groups, add this CSS class: hidden_to_group_all
To show the element/menu item to users not enrolled in any group, add this CSS class: visible_to_group_none
To hide the element/menu item from users not enrolled in any group, add this CSS class: hidden_to_group_none
For a specific group, if Group ID is 123:
To show the element/menu item to user with access to above Group, add this CSS class: visible_to_group_123
To hide the element/menu item from user with access to above Group, add this CSS class: hidden_to_group_123
For users with access to at least one group:
* Add this CSS class: hidden_to_group_none
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_group_123 visible_to_group_124 will show the element only to those who have access to both groups.
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 even 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 WP Courseware 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 LearnDash LMS:
* Manual Completions for LearnDash LMS
* Manage Enrollment for LearnDash LMS
* Autocomplete LearnDash Lessons and Topics
It is pretty similar to this plugin and having same features, it allows controlling the visibility of HTML elements based user’s purchase of a particular WooCommerce Product or Variation.
