Hello, I would like to hide the Course Menu "Home" just like I am able to hide. Activity, Members and Group. E.g. show only to Instructors.
It makes no since to have "Home" shown on its own without any other tab visible.
I found this but it only works if I remove "if ( is_singular('course')".
So this does not work:
add_action('init', function(){
if ( is_singular('course') ){
if( !current_user_can('edit_posts') || !is_user_logged_in() ){
echo '<style>.single.single-course.c6 #item-nav {display:none;}</style>';
echo 'testtest';
}} });
This does work:
add_action('init', function(){
if( !current_user_can('edit_posts') || !is_user_logged_in() ){
echo '<style>.single.single-course.c6 #item-nav {display:none;}</style>';
echo 'testtest';
} });
This reply has been marked as private.
This reply has been marked as private.
Hi
You can hide the home tab from custom css code only.
To hide please paste the below code in
Wp-admin > appearance > customizer > custom css > publish
.single-course #home{display:none;}
Hello,
but I only wan't to hide for students. Not for admin and moderator.
Okay, please remove the previous code from the customizer I have shared in above reply if you have added.
Now please paste the below custom code in
Wp-admin > Plugins > plugins editor > customizer.php > save changes
add_action('wp_footer',function (){
global $post;
if($post->post_type == 'course'){
if(!is_user_logged_in() || (is_user_logged_in() && !current_user_can('edit_posts'))){ ?>
<style> .single-course #home{display:none;}
</style>
<?php
}
}
});