Show Courses by Instructor in related courses

If you want to show “Courses by Instructor” in place of “Related courses”. As shown in the screenshot below :

You’ll still need to translate the string “Related courses” to relabel it.

Add this code in child theme functions.php :

add_filter('vibe_related_courses',function($args){

unset($args['tax_query']);

global $post;
// CHECKS is CoAuthors is activated
if ( function_exists('get_coauthors')) {

$instructor_name = get_the_author_meta('user_nicename',$post->post_author);
if(isset($instructor_name))
$args['author_name'] = $instructor_name;
else
$args['author'] = $post->post_author;

}else{
//If coAuthors is not active then set to current post author
$args['author'] = $post->post_author;
}
return $args;
});

Leave a Reply

Your email address will not be published. Required fields are marked *