{"id":4348,"date":"2021-11-17T21:39:55","date_gmt":"2021-11-18T02:39:55","guid":{"rendered":"https:\/\/learndash.com\/support\/docs\/guides\/course-grid-2-0-templates\/"},"modified":"2026-04-22T08:53:54","modified_gmt":"2026-04-22T12:53:54","password":"","slug":"course-grid-templating","status":"publish","type":"docs","link":"https:\/\/learndash.com\/support\/kb\/non-knowledgebase\/uncategorized\/course-grid-templating\/","title":{"rendered":"Course Grid 2.0 Templating"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">LearnDash Course Grid (CG) 2.0 is a brand new plugin written from scratch. It supports custom templating to make it easier for users to customize the template. All the front-end aspects of the plugin including skins, cards, filter, and pagination are customizable.<\/span><\/p>\n<p class=\"note\"><strong>NOTE<\/strong><br \/>\nThis documentation is regarding templating the Course Grid Add-on, if you want to learn more about using the actual add on and it&#8217;s features, check out our <a href=\"https:\/\/learndash.com\/support\/docs\/add-ons\/course-grid\/\">Course Grid Add-on documentation<\/a>.<\/p>\n<h2>Skin<\/h2>\n<p><span style=\"font-weight: 400;\">Skin in Course Grid 2.0 is an object that defines the whole course grid style. The Skin templates folder is located in <code>\/templates\/skins\/<\/code>. By default there are 4 different types of skins: grid, masonry, list, and legacy-v1. The first three skins are available to choose from in the Course Grid Gutenberg block while the legacy-v1 skin is specific to support CG 1.0 shortcodes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Each skin folder can have the following files:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>layout.php<\/code> (mandatory) : define skin HTML layout<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>style.css<\/code> (optional) : define skin CSS styles<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>script.js<\/code> (optional) : define skin javascript file<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">In layout.php, there are 2 available variables:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>$posts<\/code> Array of <code>WP_Post<\/code> objects which are the query results of the course grid<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>$atts learndash_course_grid<\/code> shortcode attributes<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">In layout.php, users can use the helper function <\/span><code><span style=\"font-weight: 400;\">learndash_course_grid_load_card_template( $shortcode_atts, $post )<\/span><\/code><span style=\"font-weight: 400;\"> to load the skins card template automatically.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To add a custom skin, users can follow the steps below:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Create a folder named with a unique skin slug in their active theme folder in the following path:<code> \/learndash\/course-grid\/skins\/<\/code> . For example if a user uses the Kadence theme, they can create a new folder like this: <code>wp-content\/themes\/kadence\/learndash\/course-grid\/skins\/custom-skin-slug\/<\/code> .<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\"><code>layout.php<\/code> example:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;?php<\/span>\r\n<span style=\"font-weight: 400;\">\/**<\/span>\r\n<span style=\"font-weight: 400;\">* Available variables:<\/span>\r\n<span style=\"font-weight: 400;\">*<\/span>\r\n<span style=\"font-weight: 400;\">* $posts  Array of WP_Post objects, result of the WP_Query-&gt;get_posts()<\/span>\r\n<span style=\"font-weight: 400;\">* $atts  Shortcode\/Block editor attributes that call this template<\/span>\r\n<span style=\"font-weight: 400;\">*\/<\/span>\r\n<span style=\"font-weight: 400;\">?&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">div<\/span> <span style=\"font-weight: 400;\">class<\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\">\"items-wrapper <\/span><span style=\"font-weight: 400;\">&lt;?php<\/span> <span style=\"font-weight: 400;\">echo<\/span> <span style=\"font-weight: 400;\">esc_attr<\/span><span style=\"font-weight: 400;\">( <\/span><span style=\"font-weight: 400;\">$atts<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">'skin'<\/span><span style=\"font-weight: 400;\">] ); <\/span><span style=\"font-weight: 400;\">?&gt;<\/span><span style=\"font-weight: 400;\">\"<\/span><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">&lt;?php<\/span> <span style=\"font-weight: 400;\">foreach<\/span><span style=\"font-weight: 400;\"> ( <\/span><span style=\"font-weight: 400;\">$posts<\/span><span style=\"font-weight: 400;\"> as <\/span><span style=\"font-weight: 400;\">$post<\/span><span style=\"font-weight: 400;\"> ) : <\/span><span style=\"font-weight: 400;\">?&gt;<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">&lt;?php<\/span> <span style=\"font-weight: 400;\">learndash_course_grid_load_card_template<\/span><span style=\"font-weight: 400;\">( <\/span><span style=\"font-weight: 400;\">$atts<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">$post<\/span><span style=\"font-weight: 400;\"> ); <\/span><span style=\"font-weight: 400;\">?&gt;<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">&lt;?php<\/span> <span style=\"font-weight: 400;\">endforeach<\/span><span style=\"font-weight: 400;\">; <\/span><span style=\"font-weight: 400;\">?&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/<\/span><span style=\"font-weight: 400;\">div<\/span><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n<ul>\n<li><span style=\"font-size: 16px; font-weight: 400;\">Add the required<\/span><code style=\"font-style: inherit;\"> layout.php<\/code><span style=\"font-size: 16px; font-weight: 400;\"> file to the folder with the other optional files <\/span><code style=\"font-style: inherit;\">style.css<\/code><span style=\"font-size: 16px; font-weight: 400;\"> and <\/span><code style=\"font-style: inherit;\">script.js<\/code><span style=\"font-size: 16px; font-weight: 400;\"> if necessary.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Add the following code to the active themes functions.php or a plugin:<\/span><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">add_filter<\/span><span style=\"font-weight: 400;\">( <\/span><span style=\"font-weight: 400;\">'learndash_course_grid_skins'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">function<\/span><span style=\"font-weight: 400;\">( <\/span><span style=\"font-weight: 400;\">$skins<\/span><span style=\"font-weight: 400;\"> ) {<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">$skins<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">'custom-skin-slug'<\/span><span style=\"font-weight: 400;\">] = [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'slug'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'custom-skin-slug'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'label'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'Custom Skin'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">\/\/ Optional<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'script_dependencies'<\/span><span style=\"font-weight: 400;\"> =&gt; [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'dependency-slug'<\/span><span style=\"font-weight: 400;\"> =&gt; [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'url'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'https:\/\/script_url'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'version'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'1.0'<\/span>\r\n<span style=\"font-weight: 400;\"> ]<\/span>\r\n<span style=\"font-weight: 400;\"> ],<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">\/\/ Optional<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'style_dependencies'<\/span><span style=\"font-weight: 400;\"> =&gt; [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'dependency-slug'<\/span><span style=\"font-weight: 400;\"> =&gt; [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'url'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'https:\/\/style_url'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'version'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'1.0'<\/span>\r\n<span style=\"font-weight: 400;\"> ]<\/span>\r\n<span style=\"font-weight: 400;\"> ],<\/span>\r\n<span style=\"font-weight: 400;\"> ];<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">$skins<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">} );<\/span><\/pre>\n<h2>Card<\/h2>\n<p><span style=\"font-weight: 400;\">Card in Course Grid 2.0 is an object that defines how an individual card inside a skin looks. Each skin can has multiple different card designs. Card templates folder are located in <code>\/templates\/cards\/<\/code>. By default there are 5 different cards: grid-1, grid-2, grid-3 (available for grid and masonry skin), list-1, list-2 (available for list skin).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Each card folder can have the following files:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>layout.php<\/code> (required) : defines card HTML layout.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><code>style.css<\/code> (optional) : defines card CSS stylesheet<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">To create a custom card design, users can follow the following steps:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Create a folder named with a unique card slug in their active theme folder in the following path: <code>\/learndash\/course-grid\/cards\/<\/code> . For example if a user uses the Kadence theme, they can create a new folder like this: <code>wp-content\/themes\/kadence\/learndash\/course-grid\/cards\/custom-card-slug\/<\/code><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add the required <code>layout.php<\/code> file to the folder with the other optional files <code>style.css<\/code><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add the following code to the active themes functions.php or a plugin:<\/span><\/li>\n<\/ol>\n<pre><span style=\"font-weight: 400;\">add_filter<\/span><span style=\"font-weight: 400;\">( <\/span><span style=\"font-weight: 400;\">'learndash_course_grid_cards'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">function<\/span><span style=\"font-weight: 400;\">( <\/span><span style=\"font-weight: 400;\">$cards <\/span><span style=\"font-weight: 400;\">) {<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">$cards<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">'custom-card-slug'<\/span><span style=\"font-weight: 400;\">] = [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'label'<\/span><span style=\"font-weight: 400;\"> =&gt; <\/span><span style=\"font-weight: 400;\">'Custom Card'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">\/\/ Skins this card is available for<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'skins'<\/span><span style=\"font-weight: 400;\"> =&gt; [ <\/span><span style=\"font-weight: 400;\">'grid'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'custom-skin'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'etc'<\/span><span style=\"font-weight: 400;\"> ],<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">\/\/ CG elements exist in the card design, added elements will be available in CG Gutenberg block<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'elements'<\/span><span style=\"font-weight: 400;\"> =&gt; [<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'thumbnail'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'ribbon'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'content'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'title'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'description'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'meta'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">'button'<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\"> ],<\/span>\r\n<span style=\"font-weight: 400;\"> ];<\/span>\r\n<span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">$cards<\/span><span style=\"font-weight: 400;\">;<\/span>\r\n<span style=\"font-weight: 400;\">} );<\/span><\/pre>\n<h2>Pagination<\/h2>\n<p><span style=\"font-weight: 400;\">Course Grid 2.0 comes with 2 default paginations: load more button and infinite scrolling. Pagination templates are located in <code>\/templates\/pagination\/<\/code>.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>LearnDash Course Grid (CG) 2.0 is a brand new plugin written from scratch. It supports custom templating to make it easier for users to customize the template. All the front-end aspects of the plugin including skins, cards, filter, and pagination are customizable. NOTE This documentation is regarding templating the Course Grid Add-on, if you want&#8230;<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"closed","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":[],"doc_tag":[],"knowledge_base":[],"class_list":["post-4348","docs","type-docs","status-publish","hentry"],"year_month":"2026-05","word_count":660,"total_views":"6066","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"display_name":"jack","author_link":"https:\/\/learndash.com\/support\/author\/jack\/"},"doc_category_info":[],"doc_tag_info":[],"taxonomy_info":[],"featured_image_src_large":false,"comment_info":0,"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs\/4348","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=4348"}],"version-history":[{"count":8,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs\/4348\/revisions"}],"predecessor-version":[{"id":4649,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/docs\/4348\/revisions\/4649"}],"wp:attachment":[{"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/media?parent=4348"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/doc_category?post=4348"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/doc_tag?post=4348"},{"taxonomy":"knowledge_base","embeddable":true,"href":"https:\/\/learndash.com\/support\/wp-json\/wp\/v2\/knowledge_base?post=4348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}