{"id":6625,"date":"2024-04-26T00:12:39","date_gmt":"2024-04-26T04:12:39","guid":{"rendered":"https:\/\/learndash.com\/support\/docs\/add-ons\/student-teacher-communication\/multiple-instructors-shortcode\/"},"modified":"2024-12-13T17:34:26","modified_gmt":"2024-12-13T22:34:26","password":"","slug":"multiple-instructors-shortcode","status":"publish","type":"docs","link":"https:\/\/learndash.com\/support\/kb\/add-ons\/instructor-role\/multiple-instructors-shortcode\/","title":{"rendered":"Multiple Instructors Shortcode"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\" id=\"h-the-multiple-instructors-shortcode-is-helpful-in-displaying-all-the-instructors-specific-information-on-the-course-page\">The multiple instructors shortcode is helpful in displaying all the instructors specific information on the course page.<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Displays a list of all course instructors with their avatar and names along with a link to the author profile page: <strong><code>[all_instructors]<\/code><\/strong><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Controls whether to display the instructor image or not. If the parameter is not specified it will always display the instructor image: <code><strong>[all_instructors display_img=0]<\/strong><\/code><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Controls the size of the instructor avatar image to be displayed in pixels. If the parameter is not specified it would always display the instructor image of 32 pixels: <code><strong>[all_instructors size=32]<\/strong><\/code><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Controls whether to display the instructor name or not. If the parameter is not specified it would always display the instructor name: <strong><code>[all_instructors display_name=0]<\/code><\/strong><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Controls how many instructors to display on the page. If the parameter is not specified it would always display at most 2 instructor details: <code><strong>[all_instructors visible=3]<\/strong><\/code><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you only wish to display the names of the shared course instructors then set this parameter value to 1. If the parameter is not specified it will display all course instructor details: <code><strong>[all_instructors exclude_author=1]<\/strong><\/code> <\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To use the shortcode on any other pages, make use of the course_id parameter to specify the relevant course: <strong><code>[all_instructors course_id=36]<\/code><\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"course-page\">Course Page<\/h2>\n\n\n\n<p>Add the below shortcode to the course content to display all its related course instructors on the course page.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1048\" height=\"523\" src=\"https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-10-1.png\" alt=\"Course Edit Page\" class=\"wp-image-9130\" srcset=\"https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-10-1.png 1048w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-10-1-400x200.png 400w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-10-1-800x399.png 800w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-10-1-768x383.png 768w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-10-1-360x180.png 360w\" sizes=\"auto, (max-width: 1048px) 100vw, 1048px\" \/><figcaption class=\"wp-element-caption\">Course Edit Page<\/figcaption><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"529\" src=\"https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-11.webp\" alt=\"Frontend Instructor List View\" class=\"wp-image-9131\" srcset=\"https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-11.webp 975w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-11-400x217.webp 400w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-11-800x434.webp 800w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-11-768x417.webp 768w, https:\/\/learndash.com\/support\/wp-content\/uploads\/2024\/04\/image-11-360x195.webp 360w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><figcaption class=\"wp-element-caption\">Frontend Instructor List View<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"course-grid\">Course Grid<\/h2>\n\n\n\n<p>If you are using the <a href=\"https:\/\/www.learndash.com\/add-on\/course-grid\/\">LearnDash Course Grid<\/a> add-on then you can make use of the following code snippet to display the instructor list on the course list page.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"if ( ! function_exists( 'ir_custom_add_instructor_details' ) ) {\n\t\/**\n\t * Add course instructor details in course list\n\t *\n\t * @param array $data\n\t * @param object $post\n\t * @param array $shortcode_atts\n\t * @param int $user_id\n\t *\n\t * @return string\n\t *\/\n\tfunction ir_custom_add_instructor_details( $data, $post, $shortcode_atts, $user_id ) {\n\t\tif ( learndash_get_post_type_slug('course') == $post-&gt;post_type ) {\n\t\t\t$instructor_data = '&lt;div style=&quot;padding: 10px;&quot;&gt;'.do_shortcode( &quot;[all_instructors course_id='{$post-&gt;ID}']&quot;) . '&lt;\/div&gt;&lt;div class=&quot;caption&quot;&gt;';\n\t\t\t$data = str_replace( '&lt;div class=&quot;caption&quot;&gt;', $instructor_data, $data );\n\t\t}\n\t\treturn $data;\n\t}\n\tadd_filter( 'learndash_course_grid_html_output', 'ir_custom_add_instructor_details', 10, 4 );\n}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">!<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">function_exists<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">ir_custom_add_instructor_details<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t<\/span><span style=\"color: #616E88\">\/**<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t * Add course instructor details in course list<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t *<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t * <\/span><span style=\"color: #81A1C1\">@param<\/span><span style=\"color: #616E88\"> <\/span><span style=\"color: #81A1C1\">array<\/span><span style=\"color: #616E88\"> $data<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t * <\/span><span style=\"color: #81A1C1\">@param<\/span><span style=\"color: #616E88\"> <\/span><span style=\"color: #81A1C1\">object<\/span><span style=\"color: #616E88\"> $post<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t * <\/span><span style=\"color: #81A1C1\">@param<\/span><span style=\"color: #616E88\"> <\/span><span style=\"color: #81A1C1\">array<\/span><span style=\"color: #616E88\"> $shortcode_atts<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t * <\/span><span style=\"color: #81A1C1\">@param<\/span><span style=\"color: #616E88\"> <\/span><span style=\"color: #81A1C1\">int<\/span><span style=\"color: #616E88\"> $user_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t *<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t * <\/span><span style=\"color: #81A1C1\">@return<\/span><span style=\"color: #616E88\"> <\/span><span style=\"color: #81A1C1\">string<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\t *\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t<\/span><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">ir_custom_add_instructor_details<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">post<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">shortcode_atts<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">user_id<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t<\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">learndash_get_post_type_slug<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">course<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">post<\/span><span style=\"color: #81A1C1\">-&gt;<\/span><span style=\"color: #D8DEE9\">post_type<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t\t<\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">instructor_data<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">&lt;div style=&quot;padding: 10px;&quot;&gt;<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #81A1C1\">.<\/span><span style=\"color: #88C0D0\">do_shortcode<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">[all_instructors course_id=&#39;<\/span><span style=\"color: #81A1C1\">{$<\/span><span style=\"color: #D8DEE9\">post<\/span><span style=\"color: #81A1C1\">-&gt;<\/span><span style=\"color: #D8DEE9\">ID<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">&#39;]<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">.<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">&lt;\/div&gt;&lt;div class=&quot;caption&quot;&gt;<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t\t<\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">str_replace<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">&lt;div class=&quot;caption&quot;&gt;<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">instructor_data<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t<\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t<\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t<\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t<\/span><span style=\"color: #88C0D0\">add_filter<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">learndash_course_grid_html_output<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">ir_custom_add_instructor_details<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #B48EAD\">10<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #B48EAD\">4<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The multiple instructors shortcode is helpful in displaying all the instructors specific information on the course page. Course Page Add the below shortcode to the course content to display all its related course instructors on the course page. Course Grid If you are using the LearnDash Course Grid add-on then you can make use of&#8230;<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_helpful_status":1,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"doc_category":[180],"doc_tag":[],"knowledge_base":[166],"class_list":["post-6625","docs","type-docs","status-publish","hentry","doc_category-instructor-role","knowledge_base-add-ons"],"year_month":"2026-04","word_count":380,"total_views":"2627","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"display_name":"jack","author_link":"https:\/\/learndash.com\/support\/author\/jack\/"},"doc_category_info":[{"term_name":"Instructor Role","term_url":"https:\/\/learndash.com\/support\/kb\/add-ons\/instructor-role\/"}],"doc_tag_info":[],"taxonomy_info":{"doc_category":[{"value":180,"label":"Instructor Role"}],"knowledge_base":[{"value":166,"label":"Add-ons"}]},"featured_image_src_large":false,"comment_info":0,"knowledge_base_info":[{"term_name":"Add-ons","term_url":"https:\/\/learndash.com\/support\/kb\/add-ons\/","term_slug":"add-ons"}],"knowledge_base_slug":["add-ons"],"_links":{"self":[{"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs\/6625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/comments?post=6625"}],"version-history":[{"count":5,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs\/6625\/revisions"}],"predecessor-version":[{"id":9134,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs\/6625\/revisions\/9134"}],"wp:attachment":[{"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/media?parent=6625"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/doc_category?post=6625"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/doc_tag?post=6625"},{"taxonomy":"knowledge_base","embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/knowledge_base?post=6625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}