Override author-course

Home Forums Legacy Support Support queries How-to & Troubleshooting Override author-course

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38419
    externaluses
    Participant
    I've copied author-course.php and author.php to my child theme for making modifications. They are not being used, the default wplms/author-course.php is still used.
    #38420
    externaluses
    Participant
    Duplicate post: https://wplms.io/support/forums/topic/override-author-course-php/   It this still the preferred way to do it?
    #38720
    Anshuman Sahu
    Keymaster
    you need to add the given code in your child theme functions.php file and use the code as it is or might try decreasing the priority of the hook by adding this code instead in your child theme functions.php file :

    add_filter( 'template_include','wplms_check_instructing_courses_endpoint12',999,2);

    function wplms_check_instructing_courses_endpoint12($template){

        if(!is_author())

          return $template;

        global $wp_query;

        $instructing_courses=apply_filters('wplms_instructing_courses_endpoint','instructing-courses');

        if ( !isset( $wp_query->query_vars[$instructing_courses] ) ){

           $wp_query->set( 'post_type',  array('post') );

           return get_stylesheet_directory().'/author.php';

        }else{

          $wp_query->set( 'post_type',  array('course') );

          return get_stylesheet_directory().'/author-course.php';

        }

     } then try to overwrite the author-course.php file . Make sure that you copy the author.php file in wp-content/your_child_theme folder and author-courses.php file in  wp-content/your_child_theme/course folder .

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Override author-course’ is closed to new replies.