Home › Forums › Legacy Support › Support queries › Other issues › Hide All Courses in particular Course Category
- This topic has 45 replies, 5 voices, and was last updated 3 years, 11 months ago by Anshuman Sahu.
-
AuthorPosts
-
January 9, 2020 at 1:55 pm #238855loganMemberHello, you can add your category name here: https://share.getcloudapp.com/xQu0qxdyJanuary 10, 2020 at 1:55 pm #238986ZatakkSpectatorThis reply has been marked as private.January 10, 2020 at 7:01 pm #239010DianaParticipantThis reply has been marked as private.January 13, 2020 at 1:22 pm #239203ZatakkSpectatorHi Still waiting plsJanuary 13, 2020 at 6:33 pm #239225DianaParticipant@zatakk, Apologies for the delayed response. The filters remain same, only slight change in the function Use this function function wplms_exlude_courses_directroy_cc($args){ if($args['post_type'] == 'course'){ $excluded_courses=vibe_get_option('hide_courses'); if(!empty($excluded_courses)){ if(!empty($args['post__not_in'])){ $args['post__not_in'] = array_merge($args['post__not_in'], $excluded_courses); }else{ $args['post__not_in'] = $excluded_courses; } } //print_r($args); $args = array( 'post_type' => 'course', 'tax_query' => array( array( 'taxonomy' => 'course-cat', 'field' => 'slug', //can be set to ID 'terms' => 'technology' //if field is ID you can reference by cat/term number ) ) ); $category_posts = new WP_Query($args); if($category_posts->have_posts()) : while($category_posts->have_posts()) : $category_posts->the_post(); if(!empty($args['post__not_in'])){ $args['post__not_in'][] = array_merge($args['post__not_in'], $excluded_courses); }else{ $args['post__not_in'] = $excluded_courses; } endwhile; endif; wp_reset_postdata(); } //echo "<pre>"; print_r($args); return $args; }January 14, 2020 at 12:16 pm #239325ZatakkSpectatorHi I gave following input only 'term' = "p-ce" where "p-ce" is the slug for category. But nothing is happening. I am using child categories for this "p-ce". I have also tried on category that has no child. Not working.January 15, 2020 at 2:29 pm #239499DianaParticipantThis reply has been marked as private.January 16, 2020 at 2:07 am #239539ZatakkSpectatorThis reply has been marked as private.January 16, 2020 at 2:25 pm #239629DianaParticipantThis reply has been marked as private.January 17, 2020 at 5:10 am #239662ZatakkSpectatorHi I have added the filter, but I think its working in a totally different way. Instead of hiding the courses which are mentioned, its only showing those categories which are coded. Because of that, What has happened now is the following
- Even if I click on any category, only those which are coded are being shown. Means all the filters which were earlier applied, dont work now. For example
January 18, 2020 at 8:02 am #239844Anshuman SahuKeymasterYes we are close we need to put some kinda check there . Can you please confirm do you wish to show hidden courses when someone applies its category filter from Buddypress course filter widget and also on its category page ?January 19, 2020 at 3:19 am #239873ZatakkSpectatorHi I want to hide a particular category of courses from everywhere. Should not be visible even if the category filter from Buddypress course filter widget nor on its category page. Irrespective of any other course category(parent or child) that is given, lets say I add the category 'hidden', then these hidden courses are to be totally hidden in any filters, any pages and even in the count of the total courses. They cease to exist for any record purposes. The reason why I need this is 1. When I am creating the course and editing it.- When the course has been live for sometime but now needs some new content to be added.
I am not able to delete the course for whatever other reason and not even make it a draft.
Live courses need to be tweaked for whatever reasons and still need to be acessible through a link but not from front end.
January 20, 2020 at 6:44 pm #239997DianaParticipant@zatakk, Got your point and here you mentioned that you have to maintain the count as well. This will require a slight tweak in the above shared code. Need to go through the above code again. Now, it's a bit difficult to maintain the child as well as parent categoryJanuary 24, 2020 at 3:21 am #240422ZatakkSpectatorHi Any progress pleaseJanuary 24, 2020 at 12:59 pm #240504DianaParticipant@zatakk, I can update you by monday. Apologies for this delay -
AuthorPosts
- The topic ‘Hide All Courses in particular Course Category’ is closed to new replies.