Showing course category on my courses page

Home Forums Legacy Support Support queries How-to & Troubleshooting Showing course category on my courses page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #301472
    neuromath
    Spectator
    Hi, Is it possible to show course category on My course page? or to filter by course category on My course page? https://prnt.sc/ud1ypx Something like what I have in all courses page https://prnt.sc/ud1ypx
    #301585
    Diana
    Participant
    Actually the same action hook and filter hook is applied on "All Courses Page" and "My Courses" page to list courses So Add this code in wp-admin > Plugins > editor > select wplms customizer plugin > wplms-customizer.php
    
    add_action ('bp_directory_course_item',function(){
    
      $course_id = get_the_ID();
    
      $terms = get_the_terms( $course_id, 'course-cat');
    
      if(empty($terms)){
    
        return;
    
      }
    
      $category = array();
    
      $cat = "";
    
      foreach ($terms as $term) {
    
        $category[] = $term->name;
    
      }
    
      $course_category = implode(',', $category);
    
      echo '<span class="course_categories">'.$course_category.'</span>';
    
      
    
    });
    
    
    It will show like this: http://prntscr.com/udeiqd But the same code will be applied on "All Courses" Page as well To add filtering option on the basis of course category on my courses page is not possible
    #301734
    neuromath
    Spectator
    Thanks Diana, but that's not what we want unfortunately. You mentioned that "same action hook and filter hook is applied on “All Courses Page” and “My Courses” page to list courses" If that's the case, can I have the course categories filter shown in "My courses" page too? THis one: https://prnt.sc/udnjd2
    #301858
    Diana
    Participant
    Here, what I mean with filter is wordpress hooks What does it mean? Actions and filters allow you to add your own functionality or modify your site's behavior by hooking a callback function onto a specific tag in the core code, setting priorities, and using parameters and arguments passed to the callback function. So if I write a code in "My Courses" Section to show categories, then the categories will appear on all courses page as well and I can't restrict to show only on "My courses" Page and not on "all courses" page This is what I mean The alternative is to use Blank Child Theme and overwrite the code here so that whatever you will add for "My Courses" Tab will not appear in "All courses" page
    #310043
    neuromath
    Spectator
    Hi Diana, What I meant was how can I have the same filter component that I have in "All courses" page (https://prnt.sc/udnjd2) to MY course page? Like this: https://prnt.sc/ugg5bi I achieved the look in All courses page by using the widget: https://prnt.sc/ugg6vw since the two pages have the same hook, that should work too right? but I dont know how to add that category filter. Thanks
    #310289
    Diana
    Participant
    The widgets will be applied to pages only not for a buddypress tab The "My Courses" is set as a buddypress tab and the content is fetched from there. To show widget there is not possible The same thing, I explained in my above reply as well I hope I am clear this time
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Showing course category on my courses page’ is closed to new replies.