4130eaaa by Jeff Balicki

remove un used plugins

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 98f134de
Showing 341 changed files with 0 additions and 4877 deletions
1 .learndash-course-grid .arrow {
2 all: unset;
3 }
4
5 .learndash-course-grid .arrow::after {
6 all: unset;
7 }
8
9 .learndash-course-grid iframe,
10 .learndash-course-grid embed,
11 .learndash-course-grid object,
12 .learndash-course-grid video {
13 max-width: 100%;
14 }
1 /**
2 * Elementor compatibility script
3 */
4
5 ( function() {
6 let gridFound, masonryFound;
7 const gridObserver = new MutationObserver( function( mutations ) {
8 mutations.forEach( function( mutationRecord ) {
9 const grid = mutationRecord.target.querySelector( '.learndash-course-grid' ),
10 skin = grid.dataset.skin,
11 display = mutationRecord.target.style.display;
12
13 if ( 'none' !== display ) {
14 if ( 'grid' === skin ) {
15 gridFound = true;
16 } else if ( 'masonry' === skin ) {
17 masonryFound = true;
18 }
19 }
20 } );
21
22 if ( gridFound && 'function' === typeof learndash_course_grid_init_grid_responsive_design ) {
23 learndash_course_grid_init_grid_responsive_design();
24 }
25
26 if ( masonryFound && 'function' === typeof learndash_course_grid_init_masonry_responsive_design ) {
27 learndash_course_grid_init_masonry_responsive_design();
28 }
29 } );
30
31 const grids = document.querySelectorAll( '.learndash-course-grid' );
32 grids.forEach( function( grid ) {
33 const target = grid.closest( '.elementor-tab-content' );
34 if ( target ) {
35 gridObserver.observe( target, { attributes : true, attributeFilter : [ 'style' ] } );
36 }
37 } );
38 } )();
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 namespace LearnDash\Course_Grid;
3
4 use WP_Query;
5 use LearnDash\Course_Grid\Utilities;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit();
9 }
10
11 class AJAX {
12
13 public function __construct()
14 {
15 add_action( 'wp_ajax_ld_cg_load_more', [ $this, 'load_posts' ] );
16 add_action( 'wp_ajax_nopriv_ld_cg_load_more', [ $this, 'load_posts' ] );
17
18 add_action( 'wp_ajax_ld_cg_apply_filter', [ $this, 'load_posts' ] );
19 add_action( 'wp_ajax_nopriv_ld_cg_apply_filter', [ $this, 'load_posts' ] );
20 }
21
22 public function load_posts()
23 {
24 if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'ld_cg_load_posts' ) ) {
25 wp_die();
26 }
27
28 $action_hook = current_filter();
29 $hook = false;
30 if ( strpos( $action_hook, 'ld_cg_load_more' ) !== false ) {
31 $hook = 'load_more';
32 } elseif ( strpos( $action_hook, 'ld_cg_apply_filter' ) !== false ) {
33 $hook = 'apply_filter';
34 }
35
36 if ( ! $hook ) {
37 wp_die();
38 }
39
40 $filter = json_decode( stripslashes( $_REQUEST['filter'] ), true );
41 $atts = json_decode( stripslashes( $_REQUEST['course_grid'] ), true );
42
43 $post_type = sanitize_text_field( $atts['post_type'] );
44 $page = intval( $atts['page'] );
45 $per_page = intval( $atts['per_page'] );
46 $offset = $page * $per_page;
47 $orderby = sanitize_text_field( $atts['orderby'] );
48 $order = sanitize_text_field( $atts['order'] );
49 $search = isset( $filter['search'] ) ? sanitize_text_field( $filter['search'] ) : null;
50 $pagination = sanitize_text_field( $atts['pagination'] );
51 $price_min = isset( $filter['price_min'] ) && is_numeric( $filter['price_min'] ) ? floatval( $filter['price_min'] ) : null;
52 $price_max = isset( $filter['price_max'] ) && is_numeric( $filter['price_max'] ) ? floatval( $filter['price_max'] ) : null;
53
54 if ( isset( $filter['search'] ) ) {
55 unset( $filter['search'] );
56 }
57
58 if ( isset( $filter['price_min'] ) ) {
59 unset( $filter['price_min'] );
60 }
61
62 if ( isset( $filter['price_max'] ) ) {
63 unset( $filter['price_max'] );
64 }
65
66 $posts = [];
67
68 $query_args = Utilities::build_posts_query_args( $atts );
69 $query_args['s'] = $search;
70 $query_args['offset'] = 0;
71
72 if (
73 in_array( $post_type, [ 'sfwd-courses', 'groups' ] )
74 && ( isset( $price_min ) || isset( $price_max ) )
75 ) {
76 $query_args['posts_per_page'] = -1;
77 }
78
79 if ( $hook === 'load_more' ) {
80 $offset = $page * $per_page;
81 $query_args['offset'] = $offset;
82
83 if ( $per_page == -1 ) {
84 echo json_encode( [
85 'status' => 'success',
86 'html' => '',
87 'page' => 'complete',
88 ] );
89
90 wp_die();
91 }
92 } elseif ( $hook === 'apply_filter' ) {
93 $offset = 0;
94 $query_args['offset'] = $offset;
95 }
96
97 $tax_count = 0;
98 foreach ( $filter as $taxonomy => $values ) {
99 $tax_count++;
100
101 if ( ! empty( $values ) && is_array( $values ) ) {
102 $values = array_map( function( $id ) {
103 return intval( $id );
104 }, $values );
105
106 $query_args['tax_query'][] = [
107 'taxonomy' => $taxonomy,
108 'field' => 'term_id',
109 'terms' => $values,
110 ];
111
112 if ( count( $query_args['tax_query'] ) > 1 ) {
113 $query_args['tax_query']['relation'] = 'OR';
114 }
115 }
116 }
117
118 $query_args = apply_filters( 'learndash_course_grid_query_args', $query_args, $atts, $filter );
119
120 $query = new WP_Query( $query_args );
121
122 if ( $query->have_posts() ) {
123 $posts = $query->get_posts();
124 }
125
126 $html = '';
127 $html_pagination = '';
128 if ( ! empty( $posts ) ) {
129 $card = sanitize_text_field( $atts['card'] );
130 $template = Utilities::get_card_layout( $card );
131 $has_pagination = false;
132
133 if (
134 in_array( $post_type, [ 'sfwd-courses', 'groups' ] )
135 && ( isset( $price_min ) || isset( $price_max ) )
136 && defined( 'LEARNDASH_VERSION' )
137 ) {
138 // Filter posts
139 $posts = array_filter( $posts, function( $post ) use ( $price_min, $price_max ) {
140 $price = false;
141 $price_number = false;
142 if ( $post->post_type == 'sfwd-courses' ) {
143 $price = \learndash_get_course_price( $post->ID );
144 $price_number = floatval( $price['price'] );
145 } elseif ( $post->post_type == 'groups' ) {
146 $price = \learndash_get_group_price( $post->ID );
147 $price_number = floatval( $price['price'] );
148 }
149
150 $price_min_check = true;
151 if ( $price_min === 0 || $price_min > 0 ) {
152 $price_min_check = ( $price_number >= $price_min );
153 }
154
155 $price_max_check = true;
156 if ( isset( $price_max ) ) {
157 $price_max_check = ( $price_number <= $price_max ) || ( $price_max == 0 && $price['type'] == 'free' );
158 }
159
160 if ( $price && $price_min_check && $price_max_check ) {
161 return true;
162 } else {
163 return false;
164 }
165 } );
166
167 $total_posts = count( $posts );
168 $max_num_pages = ceil( $total_posts / $per_page );
169
170 $posts = array_slice( $posts, $offset, $per_page );
171 } else {
172 $posts = $query->get_posts();
173 $max_num_pages = $query->max_num_pages;
174 }
175
176 if ( $max_num_pages > $page ) {
177 $has_pagination = true;
178 }
179
180 foreach ( $posts as $post ) {
181 ob_start();
182 if ( $template ) {
183 extract( learndash_course_grid_prepare_template_post_attributes( $post, $atts ) );
184 include $template;
185 }
186
187 $html .= ob_get_clean();
188 }
189
190 $pagination_template = Utilities::get_pagination_template( $pagination );
191
192 if ( $pagination_template && $has_pagination ) {
193 ob_start();
194 include $pagination_template;
195 $html_pagination .= ob_get_clean();
196 }
197 } else {
198 if ( $hook === 'apply_filter' ) {
199 $html .= '<p style="text-align: center;">' . __( 'No results found.', 'learndash-course-grid' ) . '</p>';
200 }
201 }
202
203 if ( $hook === 'load_more' ) {
204 $page = empty( $html ) || ( $page + 2 ) > $max_num_pages ? 'complete' : $page + 1;
205 } elseif ( $hook === 'apply_filter' ) {
206 $page = 1;
207 }
208
209 echo json_encode( [
210 'status' => 'success',
211 'html' => $html,
212 'html_pagination' => $html_pagination,
213 'page' => $page,
214 ] );
215
216 wp_die();
217 }
218 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 namespace LearnDash\Course_Grid;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use LearnDash\Course_Grid\Utilities;
9
10 class Blocks
11 {
12 public function __construct()
13 {
14 add_action( 'plugins_loaded', [ $this, 'init_blocks' ] );
15 }
16
17 public function init_blocks()
18 {
19 add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_assets' ], 20 );
20
21 $blocks = [
22 'learndash_course_grid' => 'LearnDash_Course_Grid',
23 'learndash_course_grid_filter' => 'LearnDash_Course_Grid_Filter',
24 ];
25
26 foreach ( $blocks as $id => $class ) {
27 $classname = '\\LearnDash\\Course_Grid\\Gutenberg\\Blocks\\' . $class;
28 $this->$id = new $classname();
29 }
30 }
31
32 public function enqueue_block_editor_assets()
33 {
34 $asset_file = include LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'includes/gutenberg/assets/js/index.asset.php';
35
36 wp_register_script( 'learndash-course-grid-block-editor-helper', LEARNDASH_COURSE_GRID_PLUGIN_URL . 'includes/gutenberg/assets/js/editor.js', [], LEARNDASH_COURSE_GRID_VERSION );
37
38 wp_enqueue_script( 'learndash-course-grid-block-editor', LEARNDASH_COURSE_GRID_PLUGIN_URL . 'includes/gutenberg/assets/js/index.js', array_merge( $asset_file['dependencies'], [ 'learndash-course-grid-block-editor-helper' ] ), $asset_file['version'] );
39
40 wp_enqueue_style( 'learndash-course-grid-block-editor', LEARNDASH_COURSE_GRID_PLUGIN_URL . 'includes/gutenberg/assets/css/editor.css', [], LEARNDASH_COURSE_GRID_VERSION );
41
42 learndash_course_grid_load_inline_script_locale_data();
43
44 wp_localize_script(
45 'learndash-course-grid-block-editor',
46 'LearnDash_Course_Grid_Block_Editor',
47 [
48 'post_types' => Utilities::get_post_types_for_block_editor(),
49 'skins' => \LearnDash\course_grid()->skins->get_skins(),
50 'cards' => \LearnDash\course_grid()->skins->get_cards(),
51 'editor_fields' => \LearnDash\course_grid()->skins->get_default_editor_fields(),
52 'image_sizes' => Utilities::get_image_sizes_for_block_editor(),
53 'orderby' => Utilities::get_orderby_for_block_editor(),
54 'taxonomies' => Utilities::get_taxonomies_for_block_editor(),
55 'paginations' => Utilities::get_paginations_for_block_editor(),
56 'is_learndash_active' => defined( 'LEARNDASH_VERSION' ) ? true : false,
57 ]
58 );
59 }
60 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 namespace LearnDash\Course_Grid;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use LearnDash\Course_Grid\Utilities;
9
10 class Compatibility
11 {
12 public function __construct()
13 {
14 add_filter( 'learndash_template', [ $this, 'load_v1_template' ], 100, 5 );
15
16 // Elementor
17 add_action( 'elementor/preview/enqueue_styles', [ $this, 'elementor_preview_enqueue_styles' ], 100 );
18 add_filter( 'learndash_course_grid_post_extra_course_grids', [ $this, 'elementor_post_extra_course_grids' ], 10, 2 );
19 add_action( 'learndash_course_grid_assets_loaded', [ $this, 'elementor_assets_loaded' ] );
20 }
21
22 public function load_v1_template( $filepath, $name, $args, $echo, $return_file_path )
23 {
24 if (
25 $name === 'course_list_template'
26 && defined( 'LEARNDASH_LMS_PLUGIN_DIR' ) && strpos( $filepath, LEARNDASH_LMS_PLUGIN_DIR ) !== false
27 ) {
28 if (
29 filter_var( $args['shortcode_atts']['course_grid'], FILTER_VALIDATE_BOOLEAN ) === false
30 || ! isset( $args['shortcode_atts']['course_grid'] )
31 ) {
32 return $filepath;
33 }
34
35 $template = Utilities::get_skin_item( 'legacy-v1' );
36
37 return apply_filters( 'learndash_course_grid_template', $template, $filepath, $name, $args, $return_file_path );
38 }
39
40 return $filepath;
41 }
42
43 /**
44 * Elementor
45 */
46
47 public function elementor_preview_enqueue_styles()
48 {
49 \LearnDash\course_grid()->skins->enqueue_editor_skin_assets();
50 }
51
52 public function elementor_post_extra_course_grids( $course_grids, $post )
53 {
54 if ( ! is_a( $post, 'WP_Post' ) ) {
55 return $course_grids;
56 }
57
58 $is_elementor = get_post_meta( $post->ID, '_elementor_edit_mode', true );
59
60 if ( $is_elementor ) {
61 global $learndash_course_grid_post_elementor_enabled;
62 $learndash_course_grid_post_elementor_enabled = true;
63
64 $elementor_data = get_post_meta( $post->ID, '_elementor_data', true );
65 if ( $elementor_data ) {
66 if ( is_string( $elementor_data ) ) {
67 $elementor_data = json_decode( $elementor_data, true );
68 }
69 $elements = Utilities::associative_list_pluck( $elementor_data, 'elements' );
70
71 foreach ( $elements as $element ) {
72 if ( isset( $element['widgetType'] ) ) {
73 switch ( $element['widgetType'] ) {
74 case 'tabs':
75 foreach ( $element['settings']['tabs'] as $tab ) {
76 $tags = \LearnDash\course_grid()->skins->parse_content_shortcodes( $tab['tab_content'], [] );
77
78 $course_grids[] = $tags;
79 }
80 break;
81 }
82 }
83 }
84 }
85 }
86
87 return $course_grids;
88 }
89
90 public function elementor_assets_loaded()
91 {
92 global $learndash_course_grid_post_elementor_enabled;
93
94 if ( $learndash_course_grid_post_elementor_enabled ) {
95 wp_enqueue_script( 'learndash-course-grid-elementor-compatibility', LEARNDASH_COURSE_GRID_PLUGIN_URL . '/assets/js/elementor.js', [], LEARNDASH_COURSE_GRID_VERSION, true );
96 }
97 }
98
99 public function parse_elementor_data( $data )
100 {
101 $elements = Utilities::associative_list_pluck( $data, 'elements' );
102 }
103 }
1 <?php
2 namespace LearnDash\Course_Grid;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 class Security
9 {
10 public function __construct()
11 {
12 add_filter( 'wp_kses_allowed_html', [ $this, 'filter_allowed_html' ], 10, 2 );
13 }
14
15 /**
16 * Filter to allow HTML tags for course grid meta box
17 *
18 * @param array $tags List of HTML tags
19 * @param string $context String of context
20 * @return array New allowed HTML tags
21 */
22 function filter_allowed_html( $tags, $context )
23 {
24 if ( 'learndash_course_grid_embed_code' == $context ) {
25 $tags['iframe'] = [
26 'allowfullscreen' => true,
27 'frameborder' => true,
28 'height' => true,
29 'src' => true,
30 'width' => true,
31 'allow' => true,
32 'class' => true,
33 'data-playerid' => true,
34 'allowtransparency' => true,
35 'style' => true,
36 'name' => true,
37 'watch-type' => true,
38 'url-params' => true,
39 'scrolling' => true,
40 ];
41
42 $tags['video'] = [
43 'controls' => true,
44 'autoplay' => true,
45 'height' => true,
46 'width' => true,
47 'src' => true,
48 ];
49
50 $tags['source'] = [
51 'src' => true,
52 'media' => true,
53 'sizes' => true,
54 'type' => true,
55 ];
56
57 $tags['track'] = [
58 'default' => true,
59 'src' => true,
60 'srclang' => true,
61 'kind' => true,
62 'label' => true,
63 ];
64 }
65
66 return $tags;
67 }
68 }
1 <?php
2 namespace LearnDash\Course_Grid;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 class Shortcodes
9 {
10 public function __construct()
11 {
12 add_action( 'init', [ $this, 'init_shortcodes' ] );
13 }
14
15 public function init_shortcodes()
16 {
17 $shortcodes = [
18 'learndash_course_grid' => 'LearnDash_Course_Grid',
19 'learndash_course_grid_filter' => 'LearnDash_Course_Grid_Filter',
20 ];
21
22 foreach ( $shortcodes as $tag => $class ) {
23 $classname = '\\LearnDash\\Course_Grid\\Shortcodes\\' . $class;
24 $this->$tag = new $classname();
25 }
26 }
27 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 namespace LearnDash\Course_Grid;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use LearnDash_Translations;
9 use LearnDash_Settings_Section;
10
11 if ( ( class_exists( 'LearnDash_Settings_Section' ) ) ) {
12 class Translations extends LearnDash_Settings_Section {
13
14 // Must match the Text Domain
15 private $project_slug = 'learndash-course-grid';
16 private $registered = false;
17
18 function __construct() {
19 $this->settings_page_id = 'learndash_lms_translations';
20
21 // Used within the Settings API to uniquely identify this section
22 $this->settings_section_key = 'settings_translations_'. $this->project_slug;
23
24 // Section label/header
25 $this->settings_section_label = __( 'LearnDash LMS - Course Grid', 'learndash-course-grid' );
26
27 // Class LearnDash_Translations add LD v2.5.0
28 if ( class_exists( 'LearnDash_Translations' ) ) {
29 // Method register_translation_slug add LD v2.5.5
30 if ( method_exists( 'LearnDash_Translations', 'register_translation_slug' ) ) {
31 $this->registered = true;
32 LearnDash_Translations::register_translation_slug( $this->project_slug, LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'languages' );
33 }
34 }
35
36 parent::__construct();
37 }
38
39 function add_meta_boxes( $settings_screen_id = '' ) {
40 if ( ( $settings_screen_id == $this->settings_screen_id ) && ( $this->registered === true ) ) {
41 parent::add_meta_boxes( $settings_screen_id );
42 }
43 }
44
45 function show_meta_box() {
46 $ld_translations = new LearnDash_Translations( $this->project_slug );
47 $ld_translations->show_meta_box();
48 }
49 }
50
51 add_action( 'init', function() {
52 Translations::add_section_instance();
53 } );
54 }
55
1 /* Settings */
2
3 /* General */
4
5 .learndash-course-grid-panel .components-base-control.show {
6 display: block;
7 }
8
9 .learndash-course-grid-panel .components-base-control.hide {
10 display: none;
11 }
12
13 .components-base-control .left {
14 float: left;
15 width: 48%;
16 }
17
18 .components-base-control .right {
19 float: right;
20 width: 48%;
21 }
22
23 .components-base-control .color-wrapper .clear-button {
24 float: right;
25 margin-top: 5px;
26 }
27
28 .components-base-control .clear {
29 clear: both;
30 }
31
32 .learndash-course-grid-panel select[multiple] + .components-input-control__suffix {
33 display: none;
34 }
35
36 /* Color Components */
37
38 .learndash-course-grid-panel .color-picker .components-base-control__label {
39 display: inline-block;
40 margin-bottom: 12px;
41 }
42
43 .learndash-course-grid-panel .color-wrapper > .component-color-indicator {
44 margin: 4px 10px 0px 0px;
45 display: block;
46 float: left;
47 }
48
49 .learndash-course-grid-panel .color-wrapper > .components-circular-option-picker {
50 display: block;
51 }
52
53 .learndash-course-grid-panel .color-wrapper > .components-circular-option-picker > .components-circular-option-picker__custom-clear-wrapper {
54 display: block;
55 }
56
57 /* Course Grid Filter */
58
59 .learndash-block-inner > .learndash-course-grid-filter {
60 position: relative;
61 }
62
63 .learndash-block-inner .learndash-course-grid-filter .filter {
64 margin-left: 0;
65 float: none;
66 }
67
68 .learndash-course-grid-panel .components-input-control__container select[multiple].components-select-control__input,
69 .learndash-course-grid-filter-panel .components-input-control__container select[multiple].components-select-control__input {
70 min-height: 100px;
71 padding: 0;
72 }
...\ No newline at end of file ...\ No newline at end of file
1 ( function() {
2 function init_masonry() {
3 // Masonry
4 const wrappers = document.querySelectorAll( '.learndash-course-grid[data-skin="masonry"]' );
5 wrappers.forEach( function( wrapper ) {
6 const items_wrapper = wrapper.querySelector( '.items-wrapper.masonry' );
7
8 if ( items_wrapper ) {
9 const first_item = items_wrapper.querySelector( '.item' );
10 if ( ! first_item ) {
11 return;
12 }
13 }
14
15 learndash_course_grid_init_masonry( items_wrapper );
16 } );
17 }
18
19 document.addEventListener( 'click', function( e ) {
20 const el = e.target;
21
22 if ( el.closest( '.learndash-block-inner > .learndash-course-grid' ) || el.closest( '.learndash-block-inner > .learndash-course-grid-filter' ) ) {
23 e.preventDefault();
24 }
25 } );
26
27 setInterval( function() {
28 learndash_course_grid_init_grid_responsive_design();
29
30 const temp_css = document.querySelectorAll( '.learndash-course-grid-temp-css' );
31
32 if ( temp_css ) {
33 const css_wrapper = document.getElementById( 'learndash-course-grid-custom-css' );
34
35 if ( css_wrapper ) {
36 let style = '';
37
38 temp_css.forEach( function( element ) {
39 style += element.innerText;
40 } )
41
42 css_wrapper.innerHTML = style;
43 }
44 }
45 }, 500 );
46
47 setInterval( function() {
48 init_masonry();
49 }, 2000 );
50 } )();
...\ No newline at end of file ...\ No newline at end of file
1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-server-side-render'), 'version' => 'a8f2e2e65b135cb859e151a180066f65');
...\ No newline at end of file ...\ No newline at end of file
1 /**
2 * Custom ColorPalette component.
3 *
4 * @since 2.0.7
5 */
6
7 import { Component } from '@wordpress/element';
8 import { __ } from '@wordpress/i18n';
9 import { BaseControl, Button, ColorPalette as GBColorPalette } from '@wordpress/components';
10
11 class ColorPalette extends Component {
12 constructor( props ) {
13 super( props );
14 }
15
16 render() {
17 const {
18 name,
19 value,
20 label,
21 display_state,
22 setAttributes
23 } = this.props;
24
25 return(
26 <BaseControl
27 className={ typeof display_state[ name ] !== 'undefined' && ! display_state[ name ] ? 'hide color-picker' : 'show color-picker' }
28 label={ label }
29 >
30 <div className="color-wrapper">
31 <GBColorPalette
32 colors={ [] }
33 value={ value || '' }
34 onChange={ ( new_value ) => {
35 setAttributes( { [ name ]: new_value } );
36 } }
37 clearable={ false }
38 />
39 <Button
40 className='clear-button'
41 variant='tertiary'
42 onClick={ () => {
43 setAttributes( {
44 [ name ]: null
45 } )
46 } }
47 >
48 { __( 'Clear', 'learndash-course-grid' ) }
49 </Button>
50 <div className="clear"></div>
51 </div>
52 </BaseControl>
53 );
54 }
55 }
56
57 export default ColorPalette;
1 /**
2 * FilterPanelBody component
3 *
4 * @since 2.0
5 */
6
7 /**
8 * Internal block libraries
9 */
10 import { Component } from '@wordpress/element'
11 import { __ } from '@wordpress/i18n'
12 import { PanelBody, TextControl, ToggleControl, SelectControl, BaseControl } from '@wordpress/components'
13
14 class FilterPanelBody extends Component {
15 constructor( props ) {
16 super( props );
17 }
18
19 render() {
20 const {
21 context,
22 course_grid_id,
23 search,
24 taxonomies,
25 price,
26 price_min,
27 price_max,
28 setAttributes
29 } = this.props;
30
31 let search_key = 'search';
32 let taxonomies_key = 'taxonomies';
33 let price_key = 'price';
34 let price_min_key = 'price_min';
35 let price_max_key = 'price_max';
36
37 if ( context == 'page' ) {
38 search_key = 'filter_search';
39 taxonomies_key = 'filter_taxonomies';
40 price_key = 'filter_price';
41 price_min_key = 'filter_price_min';
42 price_max_key = 'filter_price_max';
43 }
44
45 const taxonomies_options = LearnDash_Course_Grid_Block_Editor.taxonomies;
46
47 return (
48 <PanelBody
49 title={ __( 'Filter', 'learndash-course-grid' ) }
50 initialOpen={ context == 'page' ? false : true }
51 >
52 { context == 'widget' &&
53 <TextControl
54 label={ __( 'Course Grid ID', 'learndash-course-grid' ) }
55 help={ __( 'Course grid ID the filter is for.', 'learndash-course-grid' ) }
56 value={ course_grid_id || '' }
57 type={ 'text' }
58 onChange={ ( course_grid_id ) => setAttributes( { course_grid_id } ) }
59 />
60 }
61 <ToggleControl
62 label={ __( 'Search', 'learndash-course-grid' ) }
63 checked={ search }
64 onChange={ ( search ) => {
65 const search_obj = {
66 [ search_key ]: search,
67 }
68
69 setAttributes( search_obj );
70 } }
71 />
72 <BaseControl>
73 <SelectControl
74 multiple
75 label={ __( 'Taxonomies', 'learndash-course-grid' ) }
76 help={ __( 'Hold ctrl on Windows or cmd on Mac to select multiple values.', 'learndash-course-grid' ) }
77 options={ taxonomies_options }
78 value={ taxonomies || [] }
79 onChange={ ( taxonomies ) => {
80 const taxonomies_obj = {
81 [ taxonomies_key ]: taxonomies,
82 }
83
84 setAttributes( taxonomies_obj );
85 } }
86 />
87 </BaseControl>
88 <ToggleControl
89 label={ __( 'Price', 'learndash-course-grid' ) }
90 checked={ price }
91 onChange={ ( price ) => {
92 const price_obj = {
93 [ price_key ]: price,
94 }
95
96 setAttributes( price_obj );
97 } }
98 />
99 <BaseControl>
100 <TextControl
101 label={ __( 'Price Min', 'learndash-course-grid' ) }
102 className={ 'left' }
103 value={ price_min || 0 }
104 type={ 'number' }
105 onChange={ ( price_min ) => {
106 const price_min_obj = {
107 [ price_min_key ]: price_min,
108 }
109
110 setAttributes( price_min_obj );
111 } }
112 />
113 <TextControl
114 label={ __( 'Price Max', 'learndash-course-grid' ) }
115 className={ 'right' }
116 value={ price_max || 0 }
117 type={ 'number' }
118 onChange={ ( price_max ) => {
119 const price_max_obj = {
120 [ price_max_key ]: price_max,
121 }
122
123 setAttributes( price_max_obj );
124 } }
125 />
126 <div style={ { clear: 'both' } }></div>
127 </BaseControl>
128 </PanelBody>
129 );
130 }
131 }
132
133 export default FilterPanelBody;
...\ No newline at end of file ...\ No newline at end of file
1 /**
2 * Import blocks
3 */
4 import './learndash-course-grid';
5 import './learndash-course-grid-filter';
...\ No newline at end of file ...\ No newline at end of file
1 /**
2 * LearnDash Block Functions
3 *
4 * This is a collection of common functions used within the LeanDash blocks
5 *
6 * @since 2.5.9
7 * @package LearnDash
8 */
9
10 /**
11 * Will retrive meta information about the post being edited. For now
12 * this is only loaded on post edit screen for Gutenberg. So no checks
13 * are made to ensure that a post is being edited.
14 * @param string token Token to return from meta array. If not provided will array is returned.
15 */
16 export function ldlms_get_post_edit_meta( token ) {
17 if ( ( typeof token !== 'undefined') && (token != '') ) {
18 if (typeof ldlms_settings['meta']['post'][token] !== 'undefined') {
19 return ldlms_settings['meta']['post'][token];
20 }
21 } else {
22 if (typeof ldlms_settings['meta']['post'] !== 'undefined') {
23 return ldlms_settings['meta']['post'];
24 }
25 }
26 }
27
28 /**
29 * Will retrive meta information about the post being edited. For now
30 * this is only loaded on post edit screen for Gutenberg. So no checks
31 * are made to ensure that a post is being edited.
32 * @param string token Token to return from meta array. If not provided will array is returned.
33 */
34 export function ldlms_get_setting(token, default_value) {
35 if ( ( typeof token !== 'undefined' ) && ( token != '' ) && ( typeof ldlms_settings['settings'][token] !== 'undefined' ) ) {
36 var token_value = ldlms_settings['settings'][token];
37 return ldlms_settings['settings'][token];
38 }
39 return default_value;
40 }
41
42
43 /**
44 * Returns the label for custom label element
45 * @param string token Will represent the custom label field to retreive Course, Courses, Lesson, Quiz.
46 */
47 export function ldlms_get_custom_label( token ) {
48 if ((typeof ldlms_settings['meta']['post'] !== 'undefined') && (token != '')) {
49 if (typeof ldlms_settings['settings']['custom_labels'][token] !== 'undefined') {
50 token = ldlms_settings['settings']['custom_labels'][token];
51 }
52 }
53 return token;
54 }
55
56 /**
57 * Returns the lowercase label for custom label element
58 * @param string token Will represent the custom label field to retreive Course, Courses, Lesson, Quiz.
59 */
60 export function ldlms_get_custom_label_lower(token) {
61 if ((typeof ldlms_settings['meta']['post'] !== 'undefined') && (token != '')) {
62 if (typeof ldlms_settings['settings']['custom_labels'][token + '_lower'] !== 'undefined') {
63 token = ldlms_settings['settings']['custom_labels'][token + '_lower'];
64 }
65 }
66 return token;
67 }
68
69 /**
70 * Returns the slug for custom label element
71 * @param string token Will represent the custom label field to retreive Course, Courses, Lesson, Quiz.
72 */
73 export function ldlms_get_custom_label_slug(token) {
74 if (token != '') {
75 if (typeof ldlms_settings['settings']['custom_labels'][token + '_slug'] !== 'undefined') {
76 token = ldlms_settings['settings']['custom_labels'][token + '_slug'];
77 }
78 }
79 return token;
80 }
81
82 /**
83 * Will retrieve meta information about the post being edited. For now
84 * this is only loaded on post edit screen for Gutenberg. So no checks
85 * are made to ensure that a post is being edited.
86 * @param string token Token to return from meta array. If not provided will array is returned.
87 */
88 export function ldlms_get_per_page(token) {
89 if ((typeof token !== 'undefined') && (token != '')) {
90 if (typeof ldlms_settings['settings']['per_page'][token] !== 'undefined') {
91 return ldlms_settings['settings']['per_page'][token];
92 }
93 } else if (typeof ldlms_settings['meta']['posts_per_page'] !== 'undefined') {
94 return ldlms_settings['meta']['posts_per_page'];
95 }
96 }
97
98 /**
99 * Returns integer value for variable.
100 *
101 * @param mixed var_value Variable to determin integer from.
102 *
103 * @return integer value of zero.
104 */
105 export function ldlms_get_integer_value( var_value ) {
106 if ( typeof var_value === 'undefined' ) {
107 var_value = 0;
108 }
109 var_value = parseInt(var_value);
110 if (isNaN(var_value)) {
111 var_value = 0;
112 }
113
114 return var_value;
115 }
1 /**
2 * LearnDash Block ld-course-grid-filter
3 *
4 * @since 2.0
5 */
6
7 /**
8 * Internal block libraries
9 */
10 import { __, _x, sprintf } from '@wordpress/i18n'
11 import { registerBlockType } from '@wordpress/blocks'
12 import { InspectorControls, InspectorAdvancedControls } from '@wordpress/block-editor'
13 import { Fragment } from '@wordpress/element'
14 import { Panel, PanelBody, TextControl, ToggleControl, SelectControl, ColorPalette, ColorIndicator, BaseControl } from '@wordpress/components'
15 import ServerSideRender from '@wordpress/server-side-render'
16 import FilterPanelBody from '../components/filter-panel-body.js'
17
18 registerBlockType(
19 'learndash/ld-course-grid-filter',
20 {
21 title: __( 'LearnDash Course Grid Filter', 'learndash-course-grid' ),
22 description: __( 'LearnDash course grid filter widget.', 'learndash-course-grid' ),
23 icon: 'filter',
24 category: 'learndash-blocks',
25 supports: {
26 customClassName: false,
27 },
28 attributes: {
29 course_grid_id: {
30 type: 'string',
31 default: '',
32 },
33 search: {
34 type: 'boolean',
35 default: 1,
36 },
37 taxonomies: {
38 type: 'array',
39 default: [ 'category', 'post_tag' ],
40 },
41 price: {
42 type: 'boolean',
43 default: 1,
44 },
45 price_min: {
46 type: 'string',
47 default: 0,
48 },
49 price_max: {
50 type: 'string',
51 default: 1000,
52 },
53 preview_show: {
54 type: 'boolean',
55 default: 1,
56 }
57 },
58
59 edit: ( props ) => {
60 const {
61 attributes: {
62 course_grid_id,
63 search,
64 taxonomies,
65 price,
66 price_min,
67 price_max,
68 preview_show
69 },
70 setAttributes,
71 } = props;
72
73 const taxonomies_options = LearnDash_Course_Grid_Block_Editor.taxonomies;
74
75 const inspectorControls = (
76 <Fragment key={ 'learndash-course-grid-filter-settings' }>
77 <InspectorControls
78 key="controls"
79 >
80 <Panel
81 className={ 'learndash-course-grid-filter-panel' }
82 >
83 <FilterPanelBody
84 context={ 'widget' }
85 course_grid_id={ course_grid_id }
86 search={ search }
87 taxonomies={ taxonomies }
88 price={ price }
89 price_min={ price_min }
90 price_max={ price_max }
91 setAttributes={ setAttributes }
92 />
93 <PanelBody
94 title = { __( 'Preview', 'learndash-course-grid' ) }
95 initialOpen={ false }
96 >
97 <ToggleControl
98 label={ __( 'Show Preview', 'learndash-course-grid' ) }
99 checked={ !! preview_show }
100 onChange={ ( preview_show ) =>
101 setAttributes( { preview_show } )
102 }
103 />
104 </PanelBody>
105 </Panel>
106 </InspectorControls>
107 </Fragment>
108 )
109
110 function do_serverside_render( attributes ) {
111 if ( attributes.preview_show == true ) {
112 // We add the meta so the server knowns what is being edited.
113 // attributes.meta = ldlms_get_post_edit_meta()
114
115 return (
116 <ServerSideRender
117 block="learndash/ld-course-grid-filter"
118 attributes={ attributes }
119 key="learndash/ld-course-grid-filter"
120 />
121 )
122 } else {
123 return __(
124 '[learndash_course_grid_filter] shortcode output shown here',
125 'learndash-course-grid'
126 )
127 }
128 }
129
130 return [
131 inspectorControls,
132 do_serverside_render( props.attributes )
133 ];
134 },
135
136 save: ( props ) => {
137
138 },
139 }
140 );
1 <?php
2 namespace LearnDash\Course_Grid\Gutenberg\Blocks;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use LearnDash\Course_Grid\Lib\LearnDash_Gutenberg_Block;
9 use LearnDash_Gutenberg_Block as Core_LearnDash_Gutenberg_Block;
10 use WP_Block;
11
12 /**
13 * Course grid filter block trait
14 */
15 trait LearnDash_Course_Grid_Filter_Block_Trait
16 {
17 /**
18 * Object constructor
19 */
20 public function __construct() {
21 $this->shortcode_slug = 'learndash_course_grid_filter';
22 $this->block_slug = 'ld-course-grid-filter';
23 $this->block_attributes = [
24 'course_grid_id' => [
25 'type' => 'string',
26 ],
27 'search' => [
28 'type' => 'boolean',
29 ],
30 'taxonomies' => [
31 'type' => 'array',
32 ],
33 'price' => [
34 'type' => 'boolean',
35 ],
36 'price_min' => [
37 'type' => 'integer',
38 ],
39 'price_max' => [
40 'type' => 'integer',
41 ],
42 'preview_show' => [
43 'type' => 'boolean',
44 ]
45 ];
46
47 $this->self_closing = true;
48
49 $this->init();
50 }
51
52 /**
53 * Render Block
54 *
55 * This function is called per the register_block_type() function above. This function will output
56 * the block rendered content.
57 *
58 * @param array $attributes Shortcode attrbutes.
59 * @param string $block_content
60 * @param WP_Block|null $block Block object.
61 * @return void The output is echoed.
62 */
63 public function render_block( $attributes = array(), $block_content = '', WP_Block $block = null ) {
64 $attributes = $this->preprocess_block_attributes( $attributes );
65
66 $attributes = apply_filters( 'learndash_block_markers_shortcode_atts', $attributes, $this->shortcode_slug, $this->block_slug, '' );
67
68 $shortcode_params_str = '';
69 foreach ( $attributes as $key => $val ) {
70 if ( is_null( $val ) ) {
71 continue;
72 }
73
74 if ( is_array( $val ) ) {
75 $val = implode( ',', $val );
76 }
77
78 if ( ! empty( $shortcode_params_str ) ) {
79 $shortcode_params_str .= ' ';
80 }
81 $shortcode_params_str .= $key . '="' . esc_attr( $val ) . '"';
82 }
83
84 $shortcode_params_str = '[' . $this->shortcode_slug . ' ' . $shortcode_params_str . ']';
85
86 $shortcode_out = do_shortcode( $shortcode_params_str );
87
88 if ( ( empty( $shortcode_out ) ) ) {
89 $shortcode_out = '[' . $this->shortcode_slug . '] placeholder output.';
90 }
91
92 return $this->render_block_wrap( $shortcode_out, true );
93 }
94
95 /**
96 * Called from the LD function learndash_convert_block_markers_shortcode() when parsing the block content.
97 *
98 * @since 2.0
99 *
100 * @param array $attributes The array of attributes parse from the block content.
101 * @param string $shortcode_slug This will match the related LD shortcode ld_profile, ld_course_list, etc.
102 * @param string $block_slug This is the block token being processed. Normally same as the shortcode but underscore replaced with dash.
103 * @param string $content This is the orignal full content being parsed.
104 *
105 * @return array $attributes.
106 */
107 public function learndash_block_markers_shortcode_atts_filter( $attributes = array(), $shortcode_slug = '', $block_slug = '', $content = '' ) {
108 if ( $shortcode_slug === $this->shortcode_slug ) {
109 if ( isset( $shortcode_slug['preview_show'] ) ) {
110 unset( $attributes['preview_show'] );
111 }
112
113 foreach ( $attributes as $key => $value ) {
114 if ( is_array( $value ) ) {
115 $attributes[ $key ] = implode( ', ', $value );
116 } elseif ( is_string( $value ) ) {
117 // Remove quotes to prevent the attributes from being stripped out.
118 $attributes[ $key ] = str_replace( [ '"', '\'' ] , '', $attributes[ $key ] );
119 }
120 }
121 }
122
123 return $attributes;
124 }
125 }
126
127
128 if ( class_exists( 'Core_LearnDash_Gutenberg_Block' ) ) {
129 class LearnDash_Course_Grid_Filter extends Core_LearnDash_Gutenberg_Block
130 {
131 use LearnDash_Course_Grid_Filter_Block_Trait;
132 }
133 } else {
134 class LearnDash_Course_Grid_Filter extends LearnDash_Gutenberg_Block
135 {
136 use LearnDash_Course_Grid_Filter_Block_Trait;
137 }
138 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 namespace LearnDash\Course_Grid\Gutenberg\Blocks;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use LearnDash;
9 use LearnDash\Course_Grid\Lib\LearnDash_Gutenberg_Block;
10 use LearnDash_Gutenberg_Block as Core_LearnDash_Gutenberg_Block;
11 use WP_Block;
12
13 /**
14 * Course grid block trait
15 */
16 trait LearnDash_Course_Grid_Block_Trait
17 {
18 /**
19 * Object constructor
20 */
21 public function __construct() {
22 $this->shortcode_slug = 'learndash_course_grid';
23 $this->block_slug = 'ld-course-grid';
24 $this->block_attributes = array(
25 'post_type' => array(
26 'type' => 'string',
27 ),
28 'per_page' => array(
29 'type' => 'integer',
30 ),
31 'orderby' => array(
32 'type' => 'string',
33 ),
34 'order' => array(
35 'type' => 'string',
36 ),
37 'taxonomies' => array(
38 'type' => 'string',
39 ),
40 'enrollment_status' => array(
41 'type' => 'string',
42 ),
43 'progress_status' => array(
44 'type' => 'string',
45 ),
46 'thumbnail' => array(
47 'type' => 'boolean',
48 ),
49 'thumbnail_size' => array(
50 'type' => 'string',
51 ),
52 'ribbon' => array(
53 'type' => 'boolean',
54 ),
55 'content' => array(
56 'type' => 'boolean',
57 ),
58 'title' => array(
59 'type' => 'boolean',
60 ),
61 'title_clickable' => array(
62 'type' => 'boolean',
63 ),
64 'description' => array(
65 'type' => 'boolean',
66 ),
67 'description_char_max' => array(
68 'type' => 'integer',
69 ),
70 'post_meta' => array(
71 'type' => 'boolean',
72 ),
73 'button' => array(
74 'type' => 'boolean',
75 ),
76 'pagination' => array(
77 'type' => 'string',
78 ),
79 'grid_height_equal' => array(
80 'type' => 'boolean',
81 ),
82 'progress_bar' => array(
83 'type' => 'boolean',
84 ),
85 'filter' => array(
86 'type' => 'boolean',
87 ),
88 'skin' => array(
89 'type' => 'string',
90 ),
91 'card' => array(
92 'type' => 'string',
93 ),
94 'columns' => array(
95 'type' => 'integer',
96 ),
97 'min_column_width' => array(
98 'type' => 'string',
99 ),
100 'items_per_row' => array(
101 'type' => 'integer',
102 ),
103 'font_family_title' => array(
104 'type' => 'string',
105 ),
106 'font_family_description' => array(
107 'type' => 'string',
108 ),
109 'font_size_title' => array(
110 'type' => 'string',
111 ),
112 'font_size_description' => array(
113 'type' => 'string',
114 ),
115 'font_color_title' => array(
116 'type' => 'string',
117 ),
118 'font_color_description' => array(
119 'type' => 'string',
120 ),
121 'background_color_title' => array(
122 'type' => 'string',
123 ),
124 'background_color_description' => array(
125 'type' => 'string',
126 ),
127 'background_color_ribbon' => array(
128 'type' => 'string',
129 ),
130 'font_color_ribbon' => array(
131 'type' => 'string',
132 ),
133 'background_color_icon' => array(
134 'type' => 'string',
135 ),
136 'font_color_icon' => array(
137 'type' => 'string',
138 ),
139 'background_color_button' => array(
140 'type' => 'string',
141 ),
142 'font_color_button' => array(
143 'type' => 'string',
144 ),
145 // Misc
146 'id' => array(
147 'type' => 'string',
148 ),
149 'className' => array(
150 'type' => 'string',
151 ),
152 'preview_show' => array(
153 'type' => 'boolean',
154 ),
155 'display_state' => array(
156 'type' => 'object'
157 ),
158 // Filter
159 'filter_search' => [
160 'type' => 'boolean',
161 ],
162 'filter_taxonomies' => [
163 'type' => 'array',
164 ],
165 'filter_price' => [
166 'type' => 'boolean',
167 ],
168 'filter_price_min' => [
169 'type' => 'string',
170 ],
171 'filter_price_max' => [
172 'type' => 'string',
173 ],
174 );
175
176 $this->self_closing = true;
177
178 $this->init();
179 }
180
181 /**
182 * Render Block
183 *
184 * This function is called per the register_block_type() function above. This function will output
185 * the block rendered content.
186 *
187 * @param array $attributes Shortcode attrbutes.
188 * @param string $block_content
189 * @param WP_Block|null $block Block object.
190 * @return void The output is echoed.
191 */
192 public function render_block( $attributes = array(), $block_content = '', WP_Block $block = null ) {
193 $attributes = $this->preprocess_block_attributes( $attributes );
194
195 $attributes = apply_filters( 'learndash_block_markers_shortcode_atts', $attributes, $this->shortcode_slug, $this->block_slug, '' );
196
197 $shortcode_params_str = '';
198 foreach ( $attributes as $key => $val ) {
199 if ( is_null( $val ) ) {
200 continue;
201 }
202
203 if ( is_array( $val ) ) {
204 $val = implode( ',', $val );
205 }
206
207 if ( ! empty( $shortcode_params_str ) ) {
208 $shortcode_params_str .= ' ';
209 }
210 $shortcode_params_str .= $key . '="' . esc_attr( $val ) . '"';
211 }
212
213 $shortcode_params_str = '[' . $this->shortcode_slug . ' ' . $shortcode_params_str . ']';
214
215 $args = LearnDash\course_grid()->skins->parse_shortcode_tags( $shortcode_params_str );
216
217 $style = LearnDash\course_grid()->skins->generate_custom_css( $args );
218
219 ob_start();
220 ?>
221 <div class="learndash-course-grid-temp-css" style="display: none;">
222 <?php echo html_entity_decode( $style ); ?>
223 </div>
224 <?php
225 $script = ob_get_clean();
226
227 $shortcode_out = $script;
228 $shortcode_out .= do_shortcode( $shortcode_params_str );
229
230 if ( ( empty( $shortcode_out ) ) ) {
231 $shortcode_out = '[' . $this->shortcode_slug . '] placeholder output.';
232 }
233
234 return $this->render_block_wrap( $shortcode_out, true );
235 }
236
237 /**
238 * Called from the LD function learndash_convert_block_markers_shortcode() when parsing the block content.
239 *
240 * @since 2.0
241 *
242 * @param array $attributes The array of attributes parse from the block content.
243 * @param string $shortcode_slug This will match the related LD shortcode ld_profile, ld_course_list, etc.
244 * @param string $block_slug This is the block token being processed. Normally same as the shortcode but underscore replaced with dash.
245 * @param string $content This is the orignal full content being parsed.
246 *
247 * @return array $attributes.
248 */
249 public function learndash_block_markers_shortcode_atts_filter( $attributes = array(), $shortcode_slug = '', $block_slug = '', $content = '' ) {
250 if ( $shortcode_slug === $this->shortcode_slug ) {
251 if ( isset( $attributes['preview_show'] ) ) {
252 unset( $attributes['preview_show'] );
253 }
254
255 if ( isset( $attributes['className'] ) ) {
256 $attributes['class_name'] = $attributes['className'];
257 unset( $attributes['className'] );
258 }
259
260 if ( isset( $attributes['display_state'] ) ) {
261 unset( $attributes['display_state'] );
262 }
263
264 if ( ! isset( $attributes['filter_taxonomies'] ) ) {
265 $attributes['filter_taxonomies'] = '';
266 }
267
268 foreach ( $attributes as $key => $value ) {
269 if ( is_array( $value ) ) {
270 $attributes[ $key ] = implode( ', ', $value );
271 } elseif ( is_string( $value ) ) {
272 // Remove quotes to prevent the attributes from being stripped out.
273 $attributes[ $key ] = str_replace( [ '"', '\'' ] , '', $attributes[ $key ] );
274 }
275 }
276 }
277
278 return $attributes;
279 }
280 }
281
282
283 if ( class_exists( 'Core_LearnDash_Gutenberg_Block' ) ) {
284 class LearnDash_Course_Grid extends Core_LearnDash_Gutenberg_Block
285 {
286 use LearnDash_Course_Grid_Block_Trait;
287 }
288 } else {
289 class LearnDash_Course_Grid extends LearnDash_Gutenberg_Block
290 {
291 use LearnDash_Course_Grid_Block_Trait;
292 }
293 }
1 <?php
2 namespace LearnDash\Course_Grid\Shortcodes;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use WP_Query;
9 use LearnDash\Course_Grid\Utilities;
10
11 class LearnDash_Course_Grid_Filter
12 {
13 public $tag;
14
15 public function __construct()
16 {
17 $this->tag = 'learndash_course_grid_filter';
18 $this->register();
19 }
20
21 public function register()
22 {
23 add_shortcode( $this->tag, [ $this, 'render' ] );
24 }
25
26 public function get_default_atts()
27 {
28 return apply_filters( 'learndash_course_grid_filter_default_shortcode_attributes', [
29 'course_grid_id' => '',
30 'search' => true,
31 'taxonomies' => 'category, post_tag',
32 'default_taxonomies' => '',
33 'price' => true,
34 'price_min' => 0,
35 'price_max' => 1000,
36 ] );
37 }
38
39 public function render( $shortcode_atts = [], $content = '' )
40 {
41 $atts = shortcode_atts( $this->get_default_atts(), $shortcode_atts, $this->tag );
42
43 if ( empty( $atts['course_grid_id'] ) ) {
44 $output = __( 'Missing course_grid_id attribute.', 'learndash-course-grid' );
45 return $output;
46 }
47
48 $default_taxonomies = Utilities::parse_taxonomies( $atts['default_taxonomies'] );
49
50 // Get the template file
51 $template = Utilities::get_template( 'filter/layout' );
52
53 // Include the template file
54 ob_start();
55
56 echo '<div class="learndash-course-grid-filter" data-course_grid_id="' . esc_attr( $atts['course_grid_id'] ) . '" data-taxonomies="' . esc_attr( $atts['taxonomies'] ) . '">';
57
58 $atts['taxonomies'] = array_map( function( $tax ) {
59 return trim( $tax );
60 }, array_filter( explode( ',', $atts['taxonomies'] ) ) );
61
62 if ( '' === $atts['price_min'] ) {
63 $atts['price_min'] = 0;
64 }
65
66 if ( '' === $atts['price_max'] ) {
67 $atts['price_max'] = 1000;
68 }
69
70 $atts['price_step'] = ( $atts['price_max'] - $atts['price_min'] ) / 2 / 10;
71 $atts['price_step'] = ceil( $atts['price_step'] );
72
73 if ( $template ) {
74 include $template;
75 }
76
77 echo '</div>';
78
79 // Return the template HTML string
80 return ob_get_clean();
81 }
82 }
1 <?php
2 namespace LearnDash\Course_Grid\Shortcodes;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit();
6 }
7
8 use WP_Query;
9 use LearnDash\Course_Grid\Utilities;
10
11 class LearnDash_Course_Grid
12 {
13 public $tag;
14
15 public function __construct()
16 {
17 $this->tag = 'learndash_course_grid';
18 $this->register();
19 }
20
21 public function register()
22 {
23 add_shortcode( $this->tag, [ $this, 'render' ] );
24 }
25
26 public function get_default_atts()
27 {
28 return apply_filters( 'learndash_course_grid_default_shortcode_attributes', [
29 // Query
30 'post_type' => defined( 'LEARNDASH_VERSION' ) ? 'sfwd-courses' : 'post',
31 'per_page' => 9,
32 'orderby' => 'ID',
33 'order' => 'DESC',
34 'taxonomies' => '',
35 'enrollment_status' => '',
36 'progress_status' => '',
37 // Elements
38 'thumbnail' => true,
39 'thumbnail_size' => 'thumbnail',
40 'ribbon' => true,
41 'video' => false,
42 /**
43 * Content includes title, description and button
44 */
45 'content' => true,
46 'title' => true,
47 'title_clickable' => true,
48 'description' => true,
49 'description_char_max' => 120,
50 'button' => true,
51 'filter' => true,
52 /**
53 * Accepts:
54 *
55 * 'button' : Load more button
56 * 'infinite' : Infinite scrolling
57 * 'pages' : Normal AJAX pagination with number 1, 2, 3, and so on
58 * 'false' : Doesn't have pagination
59 */
60 'pagination' => 'button',
61 'grid_height_equal' => false,
62 'progress_bar' => false,
63 'post_meta' => true,
64 // Template
65 /**
66 * Accepts:
67 *
68 * All values available in templates/skins
69 */
70 'skin' => 'grid',
71 'card' => 'grid-1',
72 /**
73 * Only used in certain skin such as 'grid' and 'masonry'
74 */
75 'columns' => 3,
76 'min_column_width' => 250,
77 /**
78 * Only used in certain skin such as 'carousel'
79 */
80 'items_per_row' => 3,
81 // Styles
82 'font_family_title' => '',
83 'font_family_description' => '',
84 'font_size_title' => '',
85 'font_size_description' => '',
86 'font_color_title' => '',
87 'font_color_description' => '',
88 'background_color_title' => '',
89 'background_color_description' => '',
90 'background_color_ribbon' => '',
91 'font_color_ribbon' => '',
92 'background_color_icon' => '',
93 'font_color_icon' => '',
94 'background_color_button' => '',
95 'font_color_button' => '',
96 // Misc
97 'class_name' => '',
98 /**
99 * Random unique ID for CSS styling purpose
100 */
101 'id' => '',
102 // Filter
103 'filter_search' => true,
104 'filter_taxonomies' => '',
105 'filter_price' => true,
106 'filter_price_min' => 0,
107 'filter_price_max' => 1000,
108 ] );
109 }
110
111 public function render( $atts = [], $content = '' )
112 {
113 $atts = shortcode_atts( $this->get_default_atts(), $atts, $this->tag );
114
115 $query_args = Utilities::build_posts_query_args( $atts );
116
117 // Query the posts
118 $query = new WP_Query( $query_args );
119
120 $posts = $query->get_posts();
121 $max_num_pages = $query->max_num_pages;
122
123 if ( $max_num_pages > 1 ) {
124 $has_pagination = true;
125 } else {
126 $has_pagination = false;
127 }
128
129 $empty_id = false;
130 if ( empty( $atts['id'] ) ) {
131 $empty_id = true;
132 $atts['id'] = Utilities::generate_random_id();
133 }
134
135 $filter = filter_var( $atts['filter'], FILTER_VALIDATE_BOOLEAN );
136
137 // Get the template file
138 $template = Utilities::get_skin_layout( $atts['skin'] );
139 $pagination_template = Utilities::get_pagination_template( $atts['pagination'] );
140
141 // Include the template file
142 ob_start();
143
144 if ( $empty_id ) {
145 echo sprintf( '<!-- %s -->', __( 'The LearnDash course grid element below doesn\'t have "id" attribute set in the shortcode so it\'s generated randomyly each time it renders. Please set the "id" attribute in the shortcode so it will be consistent each time it renders. If it\'s not consistent, custom CSS rules in the site that uses the element particular ID may not work.', 'learndash-course-grid' ) );
146 }
147
148 echo '<div id="' . esc_attr( $atts['id'] ) . '" class="learndash-course-grid ' . esc_attr( $atts['class_name'] ) . '" data-page="1" ' . $this->process_attributes_as_html_attributes( $atts ) . '>';
149
150 if ( $filter === true ) {
151 echo '<button class="toggle-filter">' . __( 'Filter', 'learndash-course-grid' ) . '</button>';
152
153 echo do_shortcode( '[learndash_course_grid_filter course_grid_id="' . esc_attr( $atts['id'] ) . '" search="' . esc_attr( $atts['filter_search'] ) . '" taxonomies="' . esc_attr( $atts['filter_taxonomies'] ) . '" default_taxonomies="' . esc_attr( $atts['taxonomies'] ) . '" price="' . esc_attr( $atts['filter_price'] ) . '" price_min="' . esc_attr( $atts['filter_price_min'] ) . '" price_max="' . esc_attr( $atts['filter_price_max'] ) . '"]' );
154 }
155
156 if ( $template ) {
157 include $template;
158 }
159
160 if ( $pagination_template && $has_pagination ) {
161 include $pagination_template;
162 }
163
164 echo '</div>';
165
166 // Return the template HTML string
167 return ob_get_clean();
168 }
169
170 public function process_attributes_as_html_attributes( $atts = [] )
171 {
172 $attributes = '';
173
174 foreach ( $atts as $key => $value ) {
175 if ( is_array( $value ) ) {
176 $value = implode( ',', $value );
177 }
178
179 $attributes .= ' data-' . $key . '="' . $value . '"';
180 }
181
182 return $attributes;
183 }
184 }
1 <?php
2 namespace LearnDash;
3
4 /**
5 * Plugin Name: LearnDash LMS - Course Grid
6 * Plugin URI: https://www.learndash.com/
7 * Description: Build LearnDash course grid easily.
8 * Version: 2.0.7
9 * Author: LearnDash
10 * Author URI: https://www.learndash.com/
11 * Text Domain: learndash-course-grid
12 * Doman Path: languages
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit();
17 }
18
19 use LearnDash\Course_Grid\Admin\Meta_Boxes;
20 use LearnDash\Course_Grid\Security;
21 use LearnDash\Course_Grid\Skins;
22 use LearnDash\Course_Grid\AJAX;
23 use LearnDash\Course_Grid\Shortcodes;
24 use LearnDash\Course_Grid\Blocks;
25 use LearnDash\Course_Grid\Compatibility;
26
27 class Course_Grid {
28 private static $instance;
29
30 public $shortcodes;
31
32 public $blocks;
33
34 public $skins;
35
36 public $posts;
37
38 public static function instance()
39 {
40 if ( ! isset( self::$instance ) || ! self::$instance instanceof self ) {
41 self::$instance = new self;
42 }
43
44 return self::$instance;
45 }
46
47 public function __construct()
48 {
49 $this->define_constants();
50
51 spl_autoload_register( [ $this, 'autoload' ] );
52
53 add_action( 'plugins_loaded', [ $this, 'load_translations' ] );
54
55 $this->security = new Security();
56 $this->skins = new Skins();
57 $this->ajax = new AJAX();
58 $this->shortcodes = new Shortcodes();
59 $this->blocks = new Blocks();
60 $this->compatibility = new Compatibility();
61
62 // Include files manually
63 include_once LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'includes/functions.php';
64
65 // Admin
66 if ( is_admin() ) {
67 $this->admin = new \stdClass();
68 $this->admin->meta_boxes = new Meta_Boxes();
69 }
70 }
71
72 public function define_constants()
73 {
74 if ( ! defined( 'LEARNDASH_COURSE_GRID_VERSION' ) ) {
75 define( 'LEARNDASH_COURSE_GRID_VERSION', '2.0.7' );
76 }
77
78 if ( ! defined( 'LEARNDASH_COURSE_GRID_FILE' ) ) {
79 define( 'LEARNDASH_COURSE_GRID_FILE', __FILE__ );
80 }
81
82 if ( ! defined( 'LEARNDASH_COURSE_GRID_PLUGIN_PATH' ) ) {
83 define( 'LEARNDASH_COURSE_GRID_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
84 }
85
86 if ( ! defined( 'LEARNDASH_COURSE_GRID_PLUGIN_URL' ) ) {
87 define( 'LEARNDASH_COURSE_GRID_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
88 }
89
90 if ( ! defined( 'LEARNDASH_COURSE_GRID_PLUGIN_TEMPLATE_PATH' ) ) {
91 define( 'LEARNDASH_COURSE_GRID_PLUGIN_TEMPLATE_PATH', LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'templates/' );
92 }
93
94 if ( ! defined( 'LEARNDASH_COURSE_GRID_PLUGIN_TEMPLATE_URL' ) ) {
95 define( 'LEARNDASH_COURSE_GRID_PLUGIN_TEMPLATE_URL', LEARNDASH_COURSE_GRID_PLUGIN_URL . 'templates/' );
96 }
97
98 if ( ! defined( 'LEARNDASH_COURSE_GRID_PLUGIN_ASSET_PATH' ) ) {
99 define( 'LEARNDASH_COURSE_GRID_PLUGIN_ASSET_PATH', LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'assets/' );
100 }
101
102 if ( ! defined( 'LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL' ) ) {
103 define( 'LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL', LEARNDASH_COURSE_GRID_PLUGIN_URL . 'assets/' );
104 }
105
106 // Added for backward compatibility.
107 if ( ! defined( 'LEARNDASH_COURSE_GRID_COLUMNS' ) ) {
108 define( 'LEARNDASH_COURSE_GRID_COLUMNS', 3 );
109 }
110 }
111
112 public function autoload( $class )
113 {
114 $class_components = explode( '\\', $class );
115 $class_file = str_replace( '_', '-', strtolower( $class_components[ count( $class_components ) - 1 ] ) );
116 $filename = $class_file . '.php';
117
118 $file = false;
119
120 if ( strpos( $class, 'LearnDash\\Course_Grid\\Shortcodes\\' ) !== false ) {
121 $file = 'includes/shortcodes/class-' . $filename;
122 } elseif ( strpos( $class, 'LearnDash\\Course_Grid\\Gutenberg\\Blocks\\' ) !== false ) {
123 $file = 'includes/gutenberg/blocks/' . $class_file . '/index.php';
124 } elseif ( strpos( $class, 'LearnDash\\Course_Grid\\Admin\\' ) !== false ) {
125 $file = 'includes/admin/class-' . $filename;
126 } elseif ( strpos( $class, 'LearnDash\\Course_Grid\\Lib' ) !== false ) {
127 $file = 'includes/lib/class-' . $filename;
128 } elseif ( strpos( $class, 'LearnDash\\Course_Grid\\' ) !== false ) {
129 $file = 'includes/class-' . $filename;
130 }
131
132 if ( $file && file_exists( LEARNDASH_COURSE_GRID_PLUGIN_PATH . $file ) ) {
133 include_once LEARNDASH_COURSE_GRID_PLUGIN_PATH . $file;
134 }
135 }
136
137 public function load_translations()
138 {
139 $locale = apply_filters( 'plugin_locale', get_locale(), 'learndash-course-grid' );
140
141 load_textdomain( 'learndash-course-grid', WP_LANG_DIR . '/plugins/learndash-course-grid-' . $locale . '.mo' );
142
143 load_plugin_textdomain( 'learndash-course-grid', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
144
145 include LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'includes/class-translations.php';
146 }
147 }
148
149 function course_grid()
150 {
151 return Course_Grid::instance();
152 }
153
154 course_grid();
...\ No newline at end of file ...\ No newline at end of file
1 === LearnDash Course Grid ===
2 Author: LearnDash
3 Author URI: https://learndash.com
4 Plugin URI: https://learndash.com/add-on/course-grid/
5 LD Requires at least: 3.0
6 Slug: learndash-course-grid
7 Tags: grid, view, display
8 Requires at least: 5.0
9 Tested up to: 6.0
10 Requires PHP: 7.0
11 Stable tag: 2.0.7
12
13 Transform the course list created with shortcode [ld_course_list] to grid view.
14
15 == Description ==
16
17 The Course Grid add-on gives you the ability to create a responsive course library that can be inserted on any page or post of your site. This is a perfect feature if you have a variety of course offerings and want to give users the ability to filter through them by category.
18
19 = Add-on Features =
20
21 * Responsive grid layout of courses
22 * Filtering by category
23 * Display course featured image and short description
24 * Featured video support
25 * Dynamic course price listing
26 * Dynamic course status listing
27
28 See the [Add-on](https://learndash.com/add-on/course-grid/) page for more information.
29
30 == Installation ==
31
32 If the auto-update is not working, verify that you have a valid LearnDash LMS license via LEARNDASH LMS > SETTINGS > LMS LICENSE.
33
34 Alternatively, you always have the option to update manually. Please note, a full backup of your site is always recommended prior to updating.
35
36 1. Deactivate and delete your current version of the add-on.
37 1. Download the latest version of the add-on from our [support site](https://support.learndash.com/article-categories/free/).
38 1. Upload the zipped file via PLUGINS > ADD NEW, or to wp-content/plugins.
39 1. Activate the add-on plugin via the PLUGINS menu.
40
41 == Changelog ==
42
43 = 2.0.7 =
44
45 * Update remove ColorIndicator component as ColorPalette element now shows color sample clearly
46 * Update POT file
47 * Update upgrade LearnDash_Gutenberg_Block class from LD 4.3.0 and prioritize core class before using included class in CG addon
48 * Update LD gutenberg block lib from the latest LD core version
49 * Update in-app documentation text
50 * Fix breaking error opening style tab breaks the Gutenberg block
51 * Fix overflown video width
52 * Fix DB query for multisite install
53 * Fix PHP notice and warning errors
54 * Fix missing text domain on some strings
55 * Fix fatal error with Elementor page
56 * Fix color picker component doesn't have clear value button
57 * Fix duplicating course grid block and changing styles of one block also changes style of other block
58
59 = 2.0.6 =
60
61 * Added translation support for block strings
62 * Updated added back learndash_course_grid_custom_button_text filter hook
63 * Fixed missing course grid translations
64 * Fixed slow queries in sites with a large number of users (10,000+)
65 * Fixed allow max/min prices to be empty
66 * Fixed correctly set max-min width
67 * Fixed shortcodes having additional parameters in their tag
68 * Fixed don't show ribbon if course is closed or has no price
69 * Fixed grids not displaying correctly in Elementor
70 * Fixed skin and card assets not correctly loading in Elementor
71 * Fixed incorrect shared steps URL
72 * Fixed incorrect variable type for implode
73 * Fixed meta box styling
74 * Fixed skins and cards not being filterable
75 * Fixed incorrect post results if taxonimies attribute values are wrapped in quotes
76
77 = 2.0.5 =
78
79 * Added pre-defined taxonomies in filter dropdown
80 * Added support for new global currency in LearnDash core
81 * Added LearnDash specific selector for CSS to avoid conflicts
82 * Updated improve ribbon text logic
83 * Fixed conflict with other plugins that execute the_content() on the front-end
84 * Fixed taxonomies filter not being able to have more than 1 working term
85 * Fixed enrolled courses query returning all courses for logged out users
86 * Fixed undefined functions
87 * Fixed remove box sizing CSS rule to avoid conflicts with other themes/plugins
88 * Fixed masonry styles not working correctly
89
90 = 2.0.4 =
91
92 * Added icon supported element for cards
93 * Added conditional for element color selector
94 * Added custom color selector for ribbon, icon, and button elements
95 * Updated not started label text on CG 2.0 templates based on user activity for LD lesson and topic post type
96 * Updated not Started label based on user activity for lesson and topic
97 * Fixed card layouts and styles
98 * Fixed minor cards layout and CSS styles
99 * Fixed block editor meta setting value is not passed to front end templates
100 * Fixed incorrect variable name
101 * Fixed translations meta box on translations setting page is not loaded
102 * Fixed update translations metabox to match with plugin name
103 * Fixed undefined index error
104 * Fixed undefined JS function
105 * Fixed missing translation slug
106 * Fixed legacy v1 course grid is not detected if the shortcode already stored in HTML format in DB
107
108 = 2.0.3 =
109
110 * Updated masonry script
111 * Updated grid skin selector
112 * Fixed PHP deprecated notice
113 * Fixed legacy v1 assets are not loaded when using ld course list block
114 * Fixed compatibility error with Elementor for v1 course grid element
115
116 = 2.0.2 =
117
118 * Fixed asset loading for legacy course grids
119
120 = 2.0.1 =
121
122 * Added course enrollment status attributes and block option
123 * Udated removed fixed 4:3 aspect ratio to prevent distorted images
124 * Fixed course grid assets not loading when Elementor is being used
125
126 = 2.0.0 =
127
128 * Added course grid Gutenberg block
129 * Added learndash_course_grid shortcode
130 * Added learndash_course_grid_filter shortcode
131 * Added ability to add and use custom template
132 * Added support for CG 1.0 shortcode
133
134 = 1.7.0 =
135
136 * Added ability to use HTML in the short description box
137 * Added custom text support for groups in the Course Grid
138 * Added Completed/In Progress/Not Available status for Course Grid ribbons
139 * Added support for the Course Grid ribbon to show for students enrolled in a group
140 * Added filter 'learndash_course_grid_load_resources' to load styles/scripts dynamically wherever they are wanted using conditional logic
141 * Updated deprecated .load in jQuery with .on('load)' instead
142 * Fixed Course Grid styles not being loaded when the shortcode is used in Elementor
143 * Fixed groups progress indicator
144 * Fixed undefined variable
145 * Fixed array index error
146
147 = 1.6.0 =
148
149 * Added hook to filter course grid html output
150 * Added docblock for html output filter
151 * Added class container class names and its filter hook
152 * Updated ribbon text escaping to wp_kses_post instead of esc_attr
153 * Updated load grid resources on LD courses archive page
154 * Updated plugin name and description
155 * Updated LD get course price helper function to allow users filter the values
156 * Updated to remove #ld_course_list wrapper on course grid shortcode to prevent conflicts with page builder plugins
157 * Fixed thumbnail course URL redirects to bare URL instead of nested URL
158 * Fixed short description unable to be set to empty because legacy value is not saved when saving new value
159 * Fixed undefined index error
160
161 View the full changelog [here](https://www.learndash.com/add-on/course-grid/).
...\ No newline at end of file ...\ No newline at end of file
1 <div class="item grid-1">
2 <article id="post-<?php echo esc_attr( $post->ID ); ?>" <?php post_class( 'post', $post->ID ); ?>>
3 <?php if ( $atts['thumbnail'] == true ) : ?>
4 <div class="thumbnail">
5 <?php if ( $atts['ribbon'] == true && ! empty( $ribbon_text ) ) : ?>
6 <div class="<?php echo esc_attr( $ribbon_class ); ?>">
7 <?php echo esc_html( $ribbon_text ); ?>
8 </div>
9 <?php endif; ?>
10
11 <?php if ( $video == true ) : ?>
12 <div class="video">
13 <?php echo wp_kses( $video_embed_code, 'learndash_course_grid_embed_code' ); ?>
14 </div>
15 <?php elseif ( has_post_thumbnail( $post->ID ) ) : ?>
16 <div class="image">
17 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
18 <?php echo get_the_post_thumbnail( $post->ID, $atts['thumbnail_size'] ); ?>
19 </a>
20 </div>
21 <?php elseif ( ! has_post_thumbnail( $post->ID ) ) : ?>
22 <div class="image">
23 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
24 <img alt="" src="<?php echo LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL . 'img/thumbnail.jpg'; ?>"/>
25 </a>
26 </div>
27 <?php endif;?>
28 </div>
29 <?php endif; ?>
30
31 <?php if ( $atts['content'] == true ) : ?>
32 <div class="content">
33 <div class="top-meta">
34 <?php if ( $atts['title'] == true ) : ?>
35 <h3 class="entry-title">
36 <?php if ( $atts['title_clickable'] == true ) : ?>
37 <a href="<?php echo esc_url( $button_link ); ?>">
38 <?php endif; ?>
39 <?php echo esc_html( $title ); ?>
40 <?php if ( $atts['title_clickable'] == true ) : ?>
41 </a>
42 <?php endif; ?>
43 </h3>
44 <?php endif; ?>
45 <?php if ( $atts['post_meta'] == true && ! empty( $author ) ) : ?>
46 <div class="author">
47 <span><?php printf( _x( 'By %s', 'By author name', 'learndash-course-grid' ), $author['name'] ); ?></span>
48 </div>
49 <?php endif; ?>
50 <?php if ( $atts['post_meta'] == true && ! empty( $reviews ) ) : ?>
51 <?php
52 $reviews_floored = floor( $reviews );
53 $reviews_ceil = ceil( $reviews );
54 $reviews_number = number_format( $reviews, 1 );
55 $reviews_max = 5;
56 ?>
57 <div class="reviews">
58 <span class="label"><?php printf( __( 'Review %s', 'learndash-course-grid' ), "( {$reviews_number} )" ); ?></span>
59 <span class="stars">
60 <?php for ( $i = 1; $i <= $reviews_max; $i++ ) : ?>
61 <?php
62 if ( $i <= $reviews_floored ) {
63 $star_class = 'star-filled';
64 } elseif ( $i > $reviews_floored && floatval( $reviews_number ) > $reviews_floored && $i <= $reviews_ceil ) {
65 $star_class = 'star-half';
66 } else {
67 $star_class = 'star-empty';
68 }
69 ?>
70 <span class="icon dashicons dashicons-<?php echo esc_attr( $star_class ); ?>"></span>
71 <?php endfor; ?>
72 </span>
73 </div>
74 <?php endif; ?>
75 <?php if ( $atts['post_meta'] == true && ! empty( $categories ) ) : ?>
76 <div class="categories">
77 <span class="icon dashicons dashicons-category"></span>
78 <span><?php echo esc_html( $categories ); ?></span>
79 </div>
80 <?php endif; ?>
81 </div>
82 <?php if ( $atts['post_meta'] == true ) : ?>
83 <hr class="separator">
84 <div class="bottom-meta">
85 <?php if ( $duration ) : ?>
86 <div class="section duration">
87 <span class="icon dashicons dashicons-clock"></span>
88 <span class="wrapper">
89 <span class="label">
90 <?php _e( 'Duration', 'learndash-course-grid' ); ?>
91 </span>
92 <span class="value">
93 <?php echo esc_html( $duration ); ?>
94 </span>
95 </span>
96 </div>
97 <?php endif; ?>
98 <?php if ( $students ) : ?>
99 <div class="section total-students">
100 <span class="icon dashicons dashicons-groups"></span>
101 <span class="wrapper">
102 <span class="label">
103 <?php _e( 'Total Students', 'learndash-course-grid' ); ?>
104 </span>
105 <span class="value">
106 <?php echo esc_html( $students['count'] ); ?>
107 </span>
108 </span>
109 </div>
110 <?php endif; ?>
111 <?php if ( $lessons ) : ?>
112 <div class="section total-lessons">
113 <span class="icon dashicons dashicons-text-page"></span>
114 <span class="wrapper">
115 <span class="label">
116 <?php _e( 'Total Lessons', 'learndash-course-grid' ); ?>
117 </span>
118 <span class="value">
119 <?php echo esc_html( $lessons['count'] ); ?>
120 </span>
121 </span>
122 </div>
123 <?php endif; ?>
124 <?php if ( $quizzes ) : ?>
125 <div class="section total-quizzes">
126 <span class="icon dashicons dashicons-format-chat"></span>
127 <span class="wrapper">
128 <span class="label">
129 <?php _e( 'Total Quizzes', 'learndash-course-grid' ); ?>
130 </span>
131 <span class="value">
132 <?php echo esc_html( $quizzes['count'] ); ?>
133 </span>
134 </span>
135 </div>
136 <?php endif; ?>
137 </div>
138 <?php endif; ?>
139 <?php if ( $atts['progress_bar'] == true && defined( 'LEARNDASH_VERSION' ) ) : ?>
140 <?php if ( $post->post_type == 'sfwd-courses' ) : ?>
141 <?php echo do_shortcode( '[learndash_course_progress course_id="' . $post->ID . '" user_id="' . $user_id . '"]' ); ?>
142 <?php elseif ( $post->post_type == 'groups' ) : ?>
143 <div class="learndash-wrapper learndash-widget">
144 <?php $progress = learndash_get_user_group_progress( $post->ID, $user_id ); ?>
145 <?php learndash_get_template_part(
146 'modules/progress-group.php',
147 array(
148 'context' => 'group',
149 'user_id' => $user_id,
150 'group_id' => $post->ID,
151 ),
152 true
153 ); ?>
154 </div>
155 <?php endif; ?>
156 <?php endif; ?>
157 </div>
158 <?php endif; ?>
159 </article>
160 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .items-wrapper .grid-1 .post {
2 line-height: 1.428571429;
3 background-color: #ffffff;
4 border: 1px solid #dddddd;
5 border-radius: 4px;
6 -webkit-transition: all 0.2s ease-in-out;
7 transition: all 0.2s ease-in-out;
8 display: inline-block;
9 max-width: 100%;
10 height: auto;
11 display: block;
12 position: relative;
13 padding: 0;
14 margin: 0;
15 box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
16 -moz-box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
17 -webkit-box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
18 }
19
20 .learndash-course-grid .items-wrapper .grid-1 .ribbon {
21 text-shadow: 0 1px rgb( 0 0 0 / 30% );
22 position: absolute;
23 z-index: 2;
24 top: 20px;
25 right: 20px;
26 left: auto;
27 padding: 10px 12px;
28 border-radius: 6px;
29 color: #fff;
30 background: #fd6703;
31 font-weight: bold;
32 font-size: 1rem;
33 }
34
35 .learndash-course-grid .items-wrapper .grid-1 .ribbon::before {
36
37 }
38
39 .learndash-course-grid .items-wrapper .grid-1 .thumbnail {
40 margin: 0;
41 padding: 0;
42 }
43
44 .learndash-course-grid .items-wrapper .grid-1 .video > * {
45 border-radius: 5px;
46 }
47
48 .learndash-course-grid .items-wrapper .grid-1 .thumbnail img {
49 margin: 0 auto;
50 padding: 0;
51 width: 100%;
52 height: auto;
53 }
54
55 .learndash-course-grid .items-wrapper .grid-1 .content {
56 padding: 30px 22px;
57 color: #333333;
58 }
59
60 .learndash-course-grid .items-wrapper .grid-1 .content > *:not(:last-child) {
61 margin-bottom: 20px;
62 }
63
64 .learndash-course-grid .items-wrapper .grid-1 .content .top-meta > *:not(:last-child) {
65 margin-bottom: 20px;
66 }
67
68 .learndash-course-grid .items-wrapper .grid-1 .content .entry-title {
69 font-size: 1.2rem;
70 font-weight: bold;
71 line-height: 1.2;
72 color: #333;
73 }
74
75 .learndash-course-grid .items-wrapper .grid-1 .content .entry-title a {
76 text-decoration: none;
77 color: #333;
78 font-size: 1.2rem;
79 line-height: 1.2;
80 font-weight: bold;
81 }
82
83 .learndash-course-grid .items-wrapper .grid-1 .content .entry-content {
84 margin-bottom: 20px ;
85 }
86
87 .learndash-course-grid .items-wrapper .grid-1 .content .entry-content > * {
88 margin: 0;
89 }
90
91 .learndash-course-grid .items-wrapper .grid-1 .content .author {
92 font-size: 0.875rem;
93 color: #949ca1;
94 }
95
96 .learndash-course-grid .items-wrapper .grid-1 .content .reviews,
97 .learndash-course-grid .items-wrapper .grid-1 .content .categories {
98 font-size: 0.875rem;
99 display: flex;
100 align-items: center;
101 }
102
103 .learndash-course-grid .items-wrapper .grid-1 .icon {
104 justify-content: center;
105 margin-right: 3px;
106 }
107
108 .learndash-course-grid .items-wrapper .grid-1 .content .categories .icon {
109 font-size: 0.875rem;
110 display: flex;
111 align-items: center;
112 }
113
114
115 .learndash-course-grid .items-wrapper .grid-1 .content .reviews .label {
116 margin-right: 10px;
117 }
118
119 .learndash-course-grid .items-wrapper .grid-1 .content .reviews .stars {
120 color: #ffb703;
121 }
122
123 .learndash-course-grid .items-wrapper .grid-1 .bottom-meta {
124 display: grid;
125 grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
126 font-size: 0.75rem;
127 gap: 15px;
128 }
129
130 .learndash-course-grid .items-wrapper .grid-1 .bottom-meta .section {
131 display: flex;
132 align-items: center;
133 }
134
135 .learndash-course-grid .items-wrapper .grid-1 .bottom-meta .section .icon {
136 width: auto;
137 height: auto;
138 display: block;
139 font-size: 1rem;
140 padding: 5px;
141 background: #00bcb6;
142 color: #fff;
143 border-radius: 5px;
144 }
145
146 .learndash-course-grid .items-wrapper .grid-1 .bottom-meta .section .wrapper {
147 margin-left: 5px;
148 }
149
150 .learndash-course-grid .items-wrapper .grid-1 .bottom-meta .section .wrapper .label {
151 font-weight: bold;
152 }
153
154 .learndash-course-grid .items-wrapper .grid-1 .bottom-meta .section .wrapper > * {
155 display: block;
156 }
...\ No newline at end of file ...\ No newline at end of file
1 <div class="item grid-2">
2 <article id="post-<?php echo esc_attr( $post->ID ); ?>" <?php post_class( 'post', $post->ID ); ?>>
3 <?php if ( $atts['thumbnail'] == true ) : ?>
4 <div class="thumbnail">
5 <?php if ( $atts['ribbon'] == true && ! empty( $ribbon_text ) ) : ?>
6 <div class="<?php echo esc_attr( $ribbon_class ); ?>">
7 <?php echo esc_html( $ribbon_text ); ?>
8 </div>
9 <?php endif; ?>
10 <?php if ( $video == true ) : ?>
11 <div class="video">
12 <?php echo htmlspecialchars_decode( $video_embed_code ); ?>
13 </div>
14 <?php elseif( has_post_thumbnail( $post->ID ) ) : ?>
15 <div class="image">
16 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
17 <?php echo get_the_post_thumbnail( $post->ID, $atts['thumbnail_size'] ); ?>
18 </a>
19 </div>
20 <?php elseif( ! has_post_thumbnail( $post->ID ) ) : ?>
21 <div class="image">
22 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
23 <img alt="" src="<?php echo LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL . 'img/thumbnail.jpg'; ?>"/>
24 </a>
25 </div>
26 <?php endif;?>
27
28 <div class="arrow button"><a href="<?php echo esc_url( $button_link ); ?>"><span class="dashicons dashicons-arrow-right-alt2"></span></a></div>
29 </div>
30 <?php endif; ?>
31 <?php if ( $atts['content'] == true ) : ?>
32 <div class="content">
33 <?php if ( $atts['post_meta'] == true ) : ?>
34 <div class="meta">
35 <?php if ( $author ) : ?>
36 <div class="author">
37 <img class="avatar" src="<?php echo esc_url( $author['avatar'] ) ; ?>" alt="<?php echo $author['name'] ?>">
38 <div class="wrapper">
39 <span class="name"><?php echo esc_html( $author['name'] ); ?></span>
40 <span class="inner-wrapper">
41 <?php if ( $duration ) : ?>
42 <span class="duration"><?php printf( __( 'Duration: %s', 'learndash-course-grid' ), $duration ); ?></span>
43 <?php endif; ?>
44 <?php if ( $lessons ) : ?>
45 <span class="lessons"><?php printf( __( '%d Lessons', 'learndash-course-grid' ), $lessons['count'] ); ?></span>
46 <?php endif; ?>
47 </span>
48 </div>
49 </div>
50 <?php endif; ?>
51 </div>
52 <?php endif; ?>
53 <?php if ( $atts['title'] == true ) : ?>
54 <h3 class="entry-title">
55 <?php if ( $atts['title_clickable'] == true ) : ?>
56 <a href="<?php echo esc_url( $button_link ); ?>">
57 <?php endif; ?>
58 <?php echo esc_html( $title ); ?>
59 <?php if ( $atts['title_clickable'] == true ) : ?>
60 </a>
61 <?php endif; ?>
62 </h3>
63 <?php endif; ?>
64 <?php if ( $atts['description'] == true && ! empty( $description ) ) : ?>
65 <div class="entry-content">
66 <?php echo wp_kses( $description, 'post' ); ?>
67 </div>
68 <?php endif; ?>
69 <?php if ( $atts['progress_bar'] == true && defined( 'LEARNDASH_VERSION' ) ) : ?>
70 <?php if ( $post->post_type == 'sfwd-courses' ) : ?>
71 <?php echo do_shortcode( '[learndash_course_progress course_id="' . $post->ID . '" user_id="' . $user_id . '"]' ); ?>
72 <?php elseif ( $post->post_type == 'groups' ) : ?>
73 <div class="learndash-wrapper learndash-widget">
74 <?php $progress = learndash_get_user_group_progress( $post->ID, $user_id ); ?>
75 <?php learndash_get_template_part(
76 'modules/progress-group.php',
77 array(
78 'context' => 'group',
79 'user_id' => $user_id,
80 'group_id' => $post->ID,
81 ),
82 true
83 ); ?>
84 </div>
85 <?php endif; ?>
86 <?php endif; ?>
87 <?php if ( $atts['button'] == true ) : ?>
88 <div class="button">
89 <a role="button" href="<?php echo esc_url( $button_link ); ?>" rel="bookmark"><?php echo esc_attr( $button_text ); ?></a>
90 </div>
91 <?php endif; ?>
92 </div>
93 <?php endif; ?>
94 </article>
95 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .items-wrapper .grid-2 .post {
2 line-height: 1.428571429;
3 background-color: #ffffff;
4 border: 1px solid #dddddd;
5 border-radius: 4px;
6 -webkit-transition: all 0.2s ease-in-out;
7 transition: all 0.2s ease-in-out;
8 display: inline-block;
9 max-width: 100%;
10 height: auto;
11 display: block;
12 position: relative;
13 padding: 0;
14 margin: 0;
15 box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
16 -moz-box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
17 -webkit-box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
18 }
19
20 .learndash-course-grid .items-wrapper .grid-2 .ribbon {
21 text-shadow: 0 1px rgb( 0 0 0 / 30% );
22 position: absolute;
23 z-index: 2;
24 top: 20px;
25 right: 15px;
26 left: auto;
27 padding: 10px 12px;
28 border-radius: 6px;
29 color: #fff;
30 background: #0f69aa;
31 font-weight: bold;
32 font-size: 1rem;
33 }
34
35 .learndash-course-grid .items-wrapper .grid-2 .ribbon::before {
36
37 }
38
39 .learndash-course-grid .items-wrapper .grid-2 .thumbnail {
40 margin: 0;
41 padding: 0;
42 position: relative;
43 }
44
45 .learndash-course-grid .items-wrapper .grid-2 .thumbnail img {
46 margin: 0 auto;
47 padding: 0;
48 width: 100%;
49 height: auto;
50 }
51
52 .learndash-course-grid .items-wrapper .grid-2 .thumbnail .arrow {
53 position: absolute;
54 right: 10px;
55 bottom: -18px;
56 left: initial;
57 top: initial;
58 overflow: visible;
59 z-index: 1000;
60 height: auto;
61 width: auto;
62 margin: 0;
63 padding: 0;
64 border-radius: 100px;
65 }
66
67 .learndash-course-grid .items-wrapper .grid-2 .thumbnail .arrow a {
68 border-radius: 100px;
69 display: block;
70 }
71
72 .learndash-course-grid .items-wrapper .grid-2 .thumbnail .arrow * {
73 text-decoration: none;
74 }
75
76 .learndash-course-grid .items-wrapper .grid-2 .thumbnail .arrow .dashicons {
77 background: #fd9752;
78 color: #fff;
79 font-size: 25px;
80 width: auto;
81 height: auto;
82 padding: 5px;
83 border-radius: 100px;
84 }
85
86 .learndash-course-grid .items-wrapper .grid-2 .content {
87 padding: 30px 22px;
88 color: #333333;
89 }
90
91 .learndash-course-grid .items-wrapper .grid-2 .content > *:not(:last-child) {
92 margin-bottom: 20px;
93 }
94
95 .learndash-course-grid .items-wrapper .grid-2 .content .author {
96 display: flex;
97 gap: 15px;
98 }
99
100 .learndash-course-grid .items-wrapper .grid-2 .content .author .avatar {
101 width: 43px;
102 height: 43px;
103 border-radius: 30px;
104 display: block;
105 }
106
107 .learndash-course-grid .items-wrapper .grid-2 .content .author .wrapper {
108 display: grid;
109 width: 100%;
110 }
111
112 .learndash-course-grid .items-wrapper .grid-2 .content .author .name {
113 font-weight: bold;
114 font-size: 1rem;
115 }
116
117 .learndash-course-grid .items-wrapper .grid-2 .content .author .wrapper .lessons {
118 float: right;
119 }
120
121 .learndash-course-grid .items-wrapper .grid-2 .content .entry-title {
122 font-size: 1.2rem;
123 font-weight: bold;
124 line-height: 1.2;
125 color: #333;
126 }
127
128 .learndash-course-grid .items-wrapper .grid-2 .content .entry-title a {
129 text-decoration: none;
130 color: #333;
131 font-size: 1.2rem;
132 line-height: 1.2;
133 font-weight: bold;
134 }
135
136 .learndash-course-grid .items-wrapper .grid-2 .content .entry-content {
137 margin-bottom: 20px;
138 color: #949ca1;
139 font-size: 0.875rem;
140 }
141
142 .learndash-course-grid .items-wrapper .grid-2 .content .entry-content > * {
143 margin: 0;
144 }
145
146 .learndash-course-grid .items-wrapper .grid-2 .content .author {
147 font-size: 0.875rem;
148 color: #949ca1;
149 }
150
151 .learndash-course-grid .items-wrapper .grid-2 .content .button {
152 margin: 0;
153 padding: 0;
154 background: none;
155 border: none;
156 border-radius: 5px;
157 width: 100%;
158 }
159
160 .learndash-course-grid .items-wrapper .grid-2 .content .button a {
161 color: #ffffff;
162 font-weight: bold;
163 text-decoration: none;
164 -webkit-transition: all 0.3s ease;
165 transition: all 0.3s ease;
166 text-align: center;
167 display: -ms-flexbox;
168 display: flex;
169 justify-content: center;
170 -ms-flex-align: center;
171 align-items: center;
172 cursor: pointer;
173 background-color: #143f5e;
174 border-color: #143f5e;
175 border-radius: 5px;
176 font-size: 1rem;
177 padding: 12px 0;
178 }
179
180 .learndash-course-grid .items-wrapper .grid-2 .content .button a:hover {
181 background: #29648f;
182 border-color: #29648f;
183 }
...\ No newline at end of file ...\ No newline at end of file
1 <div class="item grid-3">
2 <article id="post-<?php echo esc_attr( $post->ID ); ?>" <?php post_class( 'post', $post->ID ); ?>>
3 <?php if ( $atts['thumbnail'] == true ) : ?>
4 <div class="thumbnail">
5 <?php if ( $video == true && ! empty( $video_embed_code ) ) : ?>
6 <div class="video">
7 <?php echo wp_kses( $video_embed_code, 'learndash_course_grid_embed_code' ); ?>
8 </div>
9 <?php elseif( has_post_thumbnail( $post->ID ) ) : ?>
10 <div class="thumbnail">
11 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
12 <?php echo get_the_post_thumbnail( $post->ID, $atts['thumbnail_size'] ); ?>
13 </a>
14 </div>
15 <?php elseif( ! has_post_thumbnail( $post->ID ) ) : ?>
16 <div class="thumbnail">
17 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
18 <img alt="" src="<?php echo LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL . 'img/thumbnail.jpg'; ?>"/>
19 </a>
20 </div>
21 <?php endif;?>
22 </div>
23 <?php endif; ?>
24 <?php if ( $atts['content'] == true ) : ?>
25 <div class="content">
26 <?php if ( $atts['title'] == true ) : ?>
27 <h3 class="entry-title">
28 <?php if ( $atts['title_clickable'] == true ) : ?>
29 <a href="<?php echo esc_url( $button_link ); ?>">
30 <?php endif; ?>
31 <?php echo esc_html( $title ); ?>
32 <?php if ( $atts['title_clickable'] == true ) : ?>
33 </a>
34 <?php endif; ?>
35 </h3>
36 <?php endif; ?>
37 <?php if ( $atts['post_meta'] ) : ?>
38 <div class="meta">
39 <?php if ( $author ) : ?>
40 <div class="author">
41 <img src="<?php echo esc_url( $author['avatar'] ); ?>" alt="<?php echo esc_attr( $author['name'] ); ?>">
42 <span><?php printf( _x( 'By %s', 'By author name', 'learndash-course-grid' ), '<span class="name">' . $author['name'] . '</span>' ); ?></span>
43 </div>
44 <?php endif; ?>
45 <?php if ( $categories ) : ?>
46 <div class="categories">
47 <?php echo esc_html( $categories ); ?>
48 </div>
49 <?php endif; ?>
50 </div>
51 <?php endif; ?>
52 <?php if ( $atts['description'] == true && ! empty( $description ) ) : ?>
53 <div class="entry-content">
54 <?php echo wp_kses( $description, 'post' ); ?>
55 </div>
56 <?php endif; ?>
57 <?php if ( $atts['post_meta'] == true ) : ?>
58 <div class="meta price-wrapper">
59 <div class="trial">
60 <?php if ( $trial_price && $trial_duration ) : ?>
61 <span><?php printf( _x( '%s for %s then', 'Price X for X duration', 'learndash-course-grid' ), $currency . $trial_price, $trial_duration ); ?></span>
62 <?php else: ?>
63 <span><?php _e( 'Price', 'learndash-course-grid' ); ?></span>
64 <?php endif; ?>
65 </div>
66 <?php if ( $price_text ) : ?>
67 <div class="price">
68 <?php echo esc_html( $price_text ); ?>
69 </div>
70 <?php endif; ?>
71 </div>
72 <?php endif; ?>
73 <?php if ( $atts['progress_bar'] == true && defined( 'LEARNDASH_VERSION' ) ) : ?>
74 <?php if ( $post->post_type == 'sfwd-courses' ) : ?>
75 <?php echo do_shortcode( '[learndash_course_progress course_id="' . $post->ID . '" user_id="' . $user_id . '"]' ); ?>
76 <?php elseif ( $post->post_type == 'groups' ) : ?>
77 <div class="learndash-wrapper learndash-widget">
78 <?php $progress = learndash_get_user_group_progress( $post->ID, $user_id ); ?>
79 <?php learndash_get_template_part(
80 'modules/progress-group.php',
81 array(
82 'context' => 'group',
83 'user_id' => $user_id,
84 'group_id' => $post->ID,
85 ),
86 true
87 ); ?>
88 </div>
89 <?php endif; ?>
90 <?php endif; ?>
91 <?php if ( $atts['button'] == true ) : ?>
92 <div class="button">
93 <a role="button" href="<?php echo esc_url( $button_link ); ?>" rel="bookmark"><?php echo esc_attr( $button_text ); ?></a>
94 </div>
95 <?php endif; ?>
96 </div>
97 <?php endif; ?>
98 </article>
99 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .items-wrapper .grid-3 .post {
2 line-height: 1.428571429;
3 background-color: #ffffff;
4 border: 1px solid #dddddd;
5 border-radius: 5px;
6 -webkit-transition: all 0.2s ease-in-out;
7 transition: all 0.2s ease-in-out;
8 display: inline-block;
9 max-width: 100%;
10 height: auto;
11 display: block;
12 position: relative;
13 padding: 20px;
14 margin: 0;
15 box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
16 -moz-box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
17 -webkit-box-shadow: 2px 2px 2px 1px rgb(0 0 0 / 5%);
18 }
19
20 .learndash-course-grid .items-wrapper .grid-3 .thumbnail {
21 margin: 0;
22 padding: 0;
23 }
24
25 .learndash-course-grid .items-wrapper .grid-3 .thumbnail img {
26 margin: 0 auto;
27 padding: 0;
28 width: 100%;
29 height: auto;
30 border-radius: 5px;
31 }
32
33 .learndash-course-grid .items-wrapper .grid-3 .content {
34 padding: 30px 0 0;
35 color: #333333;
36 }
37
38 .learndash-course-grid .items-wrapper .grid-3 .content .entry-title {
39 font-size: 1.2rem;
40 font-weight: bold;
41 line-height: 1.2;
42 color: #333;
43 margin-bottom: 15px;
44 }
45
46 .learndash-course-grid .items-wrapper .grid-3 .content .entry-title a {
47 text-decoration: none;
48 color: #333;
49 font-size: 1.2rem;
50 line-height: 1.2;
51 font-weight: bold;
52 }
53
54 .learndash-course-grid .items-wrapper .grid-3 .content .entry-content {
55 margin-bottom: 20px ;
56 color: #949ca1;
57 font-size: 0.875rem;
58 }
59
60 .learndash-course-grid .items-wrapper .grid-3 .content .entry-content > * {
61 margin: 0;
62 }
63
64 .learndash-course-grid .items-wrapper .grid-3 .content .meta {
65 display: flex;
66 align-items: center;
67 gap: 10px;
68 color: #949ca1;
69 font-size: 0.875rem;
70 margin-bottom: 20px;
71 }
72
73 .learndash-course-grid .items-wrapper .grid-3 .content .author {
74 display: flex;
75 align-items: center;
76 gap: 10px;
77 }
78
79 .learndash-course-grid .items-wrapper .grid-3 .content .author img {
80 width: 30px;
81 height: 30px;
82 display: block;
83 border-radius: 30px;
84 border: 2px solid #fd8739;
85 }
86
87 .learndash-course-grid .items-wrapper .grid-3 .content .author .name {
88 font-weight: bold;
89 }
90
91 .learndash-course-grid .items-wrapper .grid-3 .content .price-wrapper {
92 display: flex;
93 align-items: center;
94 justify-content: space-between;
95 color: #333333;
96 }
97
98 .learndash-course-grid .items-wrapper .grid-3 .content .price-wrapper > * {
99 width: 50%;
100 }
101
102 .learndash-course-grid .items-wrapper .grid-3 .content .price-wrapper .trial {
103 text-align: left;
104 }
105
106 .learndash-course-grid .items-wrapper .grid-3 .content .price-wrapper .price {
107 text-align: right;
108 }
109
110 .learndash-course-grid .items-wrapper .grid-3 .content .button {
111 margin: 0;
112 padding: 0;
113 background: none;
114 border: none;
115 width: 100%;
116 }
117
118 .learndash-course-grid .items-wrapper .grid-3 .content .button a {
119 text-decoration: none;
120 -webkit-transition: all 0.3s ease;
121 transition: all 0.3s ease;
122 text-align: center;
123 display: -ms-flexbox;
124 display: flex;
125 justify-content: center;
126 -ms-flex-align: center;
127 align-items: center;
128 cursor: pointer;
129 color: #ffffff;
130 background-color: #fd6906;
131 border-color: #fd6906;
132 border-radius: 5px;
133 font-size: 1rem;
134 font-weight: bold;
135 padding: 6px 0;
136 margin: 0 auto;
137 max-width: 70%;
138 }
139
140 .learndash-course-grid .items-wrapper .grid-3 .content .button a:hover {
141 background: #fd8739;
142 border-color: #fd8739;
143 }
...\ No newline at end of file ...\ No newline at end of file
1 <div class="item list-1">
2 <article id="post-<?php echo esc_attr( $post->ID ); ?>" <?php post_class( 'post', $post->ID ); ?>>
3 <?php if ( $atts['thumbnail'] == true ) : ?>
4 <div class="thumbnail">
5 <?php if ( $atts['post_meta'] == true && ! empty( $reviews ) ) : ?>
6 <div class="reviews">
7 <span class="icon dashicons dashicons-star-filled"></span>
8 <span class="number"><?php echo esc_html( $reviews ); ?></span>
9 </div>
10 <?php endif; ?>
11
12 <?php if ( $video == true && ! empty( $video_embed_code ) ) : ?>
13 <div class="video">
14 <?php echo wp_kses( $video_embed_code, 'learndash_course_grid_embed_code' ); ?>
15 </div>
16 <?php elseif( has_post_thumbnail( $post->ID ) ) : ?>
17 <div class="image">
18 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
19 <?php echo get_the_post_thumbnail( $post->ID, $atts['thumbnail_size'] ); ?>
20 </a>
21 </div>
22 <?php elseif( ! has_post_thumbnail( $post->ID ) ) : ?>
23 <div class="image">
24 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
25 <img alt="" src="<?php echo LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL . 'img/thumbnail.jpg'; ?>"/>
26 </a>
27 </div>
28 <?php endif;?>
29 </div>
30 <?php endif; ?>
31 <div class="content">
32 <?php if ( $atts['ribbon'] == true && ! empty( $ribbon_text ) ) : ?>
33 <div class="ribbon">
34 <?php echo esc_html( $ribbon_text ); ?>
35 </div>
36 <?php endif; ?>
37 <?php if ( $atts['post_meta'] == true && ! empty( $categories ) ) : ?>
38 <div class="categories">
39 <?php echo esc_html( $categories ); ?>
40 </div>
41 <?php endif; ?>
42 <?php if ( $atts['post_meta'] == true && ! empty( $author ) ) : ?>
43 <div class="author">
44 <img class="avatar" src="<?php echo esc_url( $author['avatar']) ; ?>" alt="<?php echo $author['name'] ?>">
45 <span><?php printf( _x( 'By %s', 'By author name', 'learndash-course-grid' ), '<span class="name">' . $author['name'] . '</span>' ); ?></span>
46 </div>
47 <?php endif; ?>
48 <h3 class="entry-title">
49 <?php if ( $atts['title_clickable'] == true ) : ?>
50 <a href="<?php echo esc_url( $button_link ); ?>">
51 <?php endif; ?>
52 <?php echo esc_html( $title ); ?>
53 <?php if ( $atts['title_clickable'] == true ) : ?>
54 </a>
55 <?php endif; ?>
56 </h3>
57 <?php if ( $atts['post_meta'] == true ) : ?>
58 <div class="meta">
59 <?php if ( $students ) : ?>
60 <div class="students">
61 <span class="icon dashicons dashicons-groups"></span>
62 <span><?php printf( _nx( '%s Student', '%s Students', $students['count'], 'Total students', 'learndash-course-grid' ), $students['count'] ); ?></span>
63 </div>
64 <?php endif; ?>
65 <?php if ( $duration ) : ?>
66 <div class="duration">
67 <span class="icon dashicons dashicons-clock"></span>
68 <span><?php echo esc_html( $duration ); ?></span>
69 </div>
70 <?php endif; ?>
71 <?php if ( $lessons ) : ?>
72 <div class="lessons">
73 <span class="icon dashicons dashicons-text-page"></span>
74 <span><?php printf( _nx( '%s Lesson', '%s Lessons', $lessons['count'], 'Total lessons', 'learndash-course-grid' ), $lessons['count'] ); ?></span>
75 </div>
76 <?php endif; ?>
77 <?php if ( $forums ) : ?>
78 <div class="forums">
79 <span class="icon dashicons dashicons-buddicons-forums"></span>
80 <span><?php printf( _nx( '%s Forum', '%s Forums', $forums['count'], 'Total forums', 'learndash-course-grid' ), $forums['count'] ); ?></span>
81 </div>
82 <?php endif; ?>
83 <?php if ( $quizzes ) : ?>
84 <div class="quizzes">
85 <span class="icon dashicons dashicons-format-chat"></span>
86 <span><?php printf( _nx( '%s Quiz', '%s Quizzes', $quizzes['count'], 'Total quizzes', 'learndash-course-grid' ), $quizzes['count'] ); ?></span>
87 </div>
88 <?php endif; ?>
89 </div>
90 <?php endif; ?>
91 <?php if ( $atts['description'] == true && ! empty( $description ) ) : ?>
92 <div class="entry-content">
93 <?php echo wp_kses( $description, 'post' ); ?>
94 </div>
95 <?php endif; ?>
96 <?php if ( $atts['progress_bar'] == true && defined( 'LEARNDASH_VERSION' ) ) : ?>
97 <?php if ( $post->post_type == 'sfwd-courses' ) : ?>
98 <?php echo do_shortcode( '[learndash_course_progress course_id="' . $post->ID . '" user_id="' . $user_id . '"]' ); ?>
99 <?php elseif ( $post->post_type == 'groups' ) : ?>
100 <div class="learndash-wrapper learndash-widget">
101 <?php $progress = learndash_get_user_group_progress( $post->ID, $user_id ); ?>
102 <?php learndash_get_template_part(
103 'modules/progress-group.php',
104 array(
105 'context' => 'group',
106 'user_id' => $user_id,
107 'group_id' => $post->ID,
108 ),
109 true
110 ); ?>
111 </div>
112 <?php endif; ?>
113 <?php endif; ?>
114 <?php if ( $atts['button'] == true ) : ?>
115 <div class="button-wrapper">
116 <a class="link" role="button" href="<?php echo esc_url( $button_link ); ?>" rel="bookmark"><?php echo esc_attr( $button_text ); ?></a>
117 <div class="button">
118 <div class="arrow"><a href="<?php echo esc_url( $button_link ); ?>"><span class="dashicons dashicons-arrow-right-alt"></span></a></div>
119 </div>
120 </div>
121 <?php endif; ?>
122 </div>
123 </article>
124 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .items-wrapper .list-1 .post {
2 display: flex;
3 flex-direction: row;
4 gap: 60px;
5 margin-bottom: 60px;
6 }
7
8 .learndash-course-grid .items-wrapper .list-1 .ribbon {
9 text-shadow: 0 1px rgb( 0 0 0 / 30% );
10 position: absolute;
11 z-index: 2;
12 top: 0;
13 right: 0;
14 left: auto;
15 padding: 10px 12px;
16 color: #fff;
17 background: #00bcb6;
18 font-weight: bold;
19 font-size: 1rem;
20 border-radius: 5px;
21 display: flex;
22 align-items: center;
23 justify-content: center;
24 }
25
26 .learndash-course-grid .items-wrapper .list-1 .ribbon::before {
27
28 }
29
30 .learndash-course-grid .items-wrapper .list-1 .thumbnail {
31 margin: 0;
32 padding: 0;
33 position: relative;
34 width: 50%;
35 }
36
37 .learndash-course-grid .items-wrapper .list-1 .thumbnail .reviews {
38 position: absolute;
39 right: 24px;
40 top: 14px;
41 padding: 5px 10px;
42 display: flex;
43 gap: 5px;
44 align-items: center;
45 background: #ffb703;
46 color: #fff;
47 border-radius: 5px;
48 }
49
50 .learndash-course-grid .items-wrapper .list-1 .icon {
51 justify-content: center;
52 margin-right: 3px;
53 }
54
55 .learndash-course-grid .items-wrapper .list-1 .thumbnail .reviews .icon {
56 font-size: 1rem;
57 display: flex;
58 align-items: center;
59 }
60
61 .learndash-course-grid .items-wrapper .list-1 .thumbnail img {
62 margin: 0 auto;
63 padding: 0;
64 width: 100%;
65 height: 100%;
66 max-height: 280px;
67 }
68
69 .learndash-course-grid .items-wrapper .list-1 .thumbnail .arrow {
70 position: absolute;
71 right: 17px;
72 bottom: -18px;
73 }
74
75 .learndash-course-grid .items-wrapper .list-1 .arrow::after {
76 display: none;
77 }
78
79 .learndash-course-grid .items-wrapper .list-1 .thumbnail .arrow * {
80 text-decoration: none;
81 }
82
83 .learndash-course-grid .items-wrapper .list-1 .thumbnail .arrow .icon {
84 background: #fd9752;
85 color: #fff;
86 font-size: 25px;
87 width: auto;
88 height: auto;
89 padding: 5px;
90 border-radius: 100px;
91 }
92
93 .learndash-course-grid .items-wrapper .list-1 .content {
94 color: #333333;
95 position: relative;
96 width: 50%;
97 }
98
99 .learndash-course-grid .items-wrapper .list-1 .content .categories {
100 color: #fd8534;
101 font-weight: bold;
102 margin-bottom: 20px;
103 }
104
105 .learndash-course-grid .items-wrapper .list-1 .content .author {
106 display: flex;
107 gap: 5px;
108 font-size: 0.875rem;
109 color: #949ca1;
110 margin-bottom: 25px;
111 align-items: center;
112 }
113
114 .learndash-course-grid .items-wrapper .list-1 .content .author .avatar {
115 width: 30px;
116 height: 30px;
117 border-radius: 30px;
118 display: block;
119 border: 2px solid #ff7e55;
120 }
121
122 .learndash-course-grid .items-wrapper .list-1 .content .author .wrapper {
123 display: grid;
124 width: 100%;
125 }
126
127 .learndash-course-grid .items-wrapper .list-1 .content .author .name {
128 font-weight: bold;
129 }
130
131 .learndash-course-grid .items-wrapper .list-1 .content .author .wrapper .lessons {
132 float: right;
133 }
134
135 .learndash-course-grid .items-wrapper .list-1 .content .meta {
136 display: flex;
137 gap: 15px;
138 font-size: 0.875rem;
139 color: #b1b2b2;
140 margin-bottom: 20px;
141 }
142
143 .learndash-course-grid .items-wrapper .list-1 .content .meta > div {
144 display: flex;
145 align-items: center;
146 }
147
148 .learndash-course-grid .items-wrapper .list-1 .content .meta .icon {
149 font-size: 1rem;
150 display: flex;
151 align-items: center;
152 }
153
154 .learndash-course-grid .items-wrapper .list-1 .content .entry-title {
155 font-size: 1.4rem;
156 font-weight: bold;
157 line-height: 1.2;
158 color: #333;
159 margin-bottom: 10px;
160 }
161
162 .learndash-course-grid .items-wrapper .list-1 .content .entry-title a {
163 text-decoration: none;
164 color: #333;
165 font-size: 1.4rem;
166 line-height: 1.2;
167 font-weight: bold;
168 }
169
170 .learndash-course-grid .items-wrapper .list-1 .content .entry-content {
171 margin-bottom: 20px;
172 color: #b1b2b2;
173 font-size: 0.875rem;
174 }
175
176 .learndash-course-grid .items-wrapper .list-1 .content .entry-content > * {
177 margin: 0;
178 }
179
180 .learndash-course-grid .items-wrapper .list-1 .content .button-wrapper {
181 display: flex;
182 align-items: center;
183 }
184
185 .learndash-course-grid .items-wrapper .list-1 .content a.link {
186 background: none;
187 color: #a9aaaa;
188 text-decoration: none;
189 padding-bottom: 5px;
190 border-bottom: 2px solid #a9aaaa;
191 }
192
193 .learndash-course-grid .items-wrapper .list-1 .content .button {
194 background: none;
195 border: none;
196 border-radius: 5px;
197 padding: 0;
198 display: flex;
199 justify-content: space-between;
200 align-items: center;
201 margin-left: auto;
202 min-height: 30px;
203 }
204
205 .learndash-course-grid .items-wrapper .list-1 .content .button a:hover {
206 color: #d5d6d6;
207 }
208
209 .learndash-course-grid .items-wrapper .list-1 .content .button .arrow {
210 background: #f6617b;
211 padding: 0px 10px;
212 color: #fff;
213 border-radius: 5px;
214
215 width: initial;
216 height: initial;
217 overflow: initial;
218 position: initial;
219 margin: initial
220 }
221
222 .learndash-course-grid .items-wrapper .list-1 .content .button .arrow a {
223 text-decoration: none;
224 color: #fff;
225 border: none;
226 padding: 0;
227 display: flex;
228 align-items: center;
229 }
230
231 @media only screen and ( max-width: 768px ) {
232 .learndash-course-grid .items-wrapper .list-1 .post {
233 flex-direction: column;
234 }
235
236 .learndash-course-grid .items-wrapper .list-1 .thumbnail {
237 width: 100%;
238 }
239
240 .learndash-course-grid .items-wrapper .list-1 .content {
241 width: 100%;
242 }
243 }
...\ No newline at end of file ...\ No newline at end of file
1 <div class="item <?php echo esc_attr( $atts['card'] ); ?>">
2 <article id="post-<?php echo esc_attr( $post->ID ); ?>" <?php post_class( 'post', $post->ID ); ?>>
3 <?php if ( $atts['thumbnail'] == true ) : ?>
4 <div class="thumbnail">
5 <?php if ( $video == true && ! empty( $video_embed_code ) ) : ?>
6 <div class="video">
7 <?php echo wp_kses( $video_embed_code, 'learndash_course_grid_embed_code' ); ?>
8 </div>
9 <?php elseif ( has_post_thumbnail( $post->ID ) ) : ?>
10 <div class="image">
11 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
12 <?php echo get_the_post_thumbnail( $post->ID, $atts['thumbnail_size'] ); ?>
13 </a>
14 </div>
15 <?php elseif ( ! has_post_thumbnail( $post->ID ) ) : ?>
16 <div class="image">
17 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
18 <img alt="" src="<?php echo LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL . 'img/thumbnail.jpg'; ?>"/>
19 </a>
20 </div>
21 <?php endif;?>
22 </div>
23 <?php endif; ?>
24 <div class="content">
25 <div class="wrapper">
26 <div class="title-wrapper">
27 <?php if ( $atts['title'] == true ) : ?>
28 <h3 class="entry-title">
29 <?php if ( $atts['title_clickable'] == true ) : ?>
30 <a href="<?php echo esc_url( $button_link ); ?>">
31 <?php endif; ?>
32 <?php echo esc_html( $title ); ?>
33 <?php if ( $atts['title_clickable'] == true ) : ?>
34 </a>
35 <?php endif; ?>
36 </h3>
37 <?php endif; ?>
38 <div class="meta top-meta">
39 <?php if ( $atts['post_meta'] == true && ! empty( $author ) ) : ?>
40 <div class="author">
41 <span class="name"><?php echo esc_html( $author['name'] ); ?></span>
42 </div>
43 <?php endif; ?>
44 <?php if ( $atts['post_meta'] == true && ! empty( $categories ) ) : ?>
45 <div class="categories">
46 <?php echo esc_html( $categories ); ?>
47 </div>
48 <?php endif; ?>
49 </div>
50 </div>
51 <?php if ( $atts['ribbon'] == true && ! empty( $ribbon_text ) ) : ?>
52 <div class="ribbon">
53 <?php echo esc_html( $ribbon_text ); ?>
54 </div>
55 <?php endif; ?>
56 </div>
57 <?php if ( $atts['description'] == true && ! empty( $description ) ) : ?>
58 <div class="entry-content">
59 <?php echo wp_kses( $description, 'post' ); ?>
60 </div>
61 <?php endif; ?>
62 <?php if ( $atts['post_meta'] == true ) : ?>
63 <div class="meta bottom-meta">
64 <?php if ( $duration ) : ?>
65 <div class="duration">
66 <span class="icon dashicons dashicons-clock"></span>
67 <span><?php echo esc_html( $duration ); ?></span>
68 </div>
69 <?php endif; ?>
70 <?php if ( $lessons ) : ?>
71 <div class="lessons">
72 <span class="icon dashicons dashicons-text-page"></span>
73 <span><?php printf( _nx( '%s Lesson', '%s Lessons', $lessons['count'], 'Total lessons', 'learndash-course-grid' ), $lessons['count'] ); ?></span>
74 </div>
75 <?php endif; ?>
76 <?php if ( $students ) : ?>
77 <div class="students">
78 <span class="icon dashicons dashicons-groups"></span>
79 <span><?php printf( _nx( '%s Student', '%s Students', $students['count'], 'Total students', 'learndash-course-grid' ), $students['count'] ); ?></span>
80 </div>
81 <?php endif; ?>
82 <?php if ( $reviews ) : ?>
83 <?php
84 $reviews_floored = floor( $reviews );
85 $reviews_ceil = ceil( $reviews );
86 $reviews_number = number_format( $reviews, 1 );
87 $reviews_max = 5;
88 ?>
89 <div class="reviews">
90 <span class="label"><?php printf( '%s', $reviews_number ); ?></span>
91 <span class="stars">
92 <?php for ( $i = 1; $i <= $reviews_max; $i++ ) : ?>
93 <?php
94 if ( $i <= $reviews_floored ) {
95 $star_class = 'star-filled';
96 } elseif ( $i > $reviews_floored && floatval( $reviews_number ) > $reviews_floored && $i <= $reviews_ceil ) {
97 $star_class = 'star-half';
98 } else {
99 $star_class = 'star-empty';
100 }
101 ?>
102 <span class="icon dashicons dashicons-<?php echo esc_attr( $star_class ); ?>"></span>
103 <?php endfor; ?>
104 </span>
105 </div>
106 <?php endif; ?>
107 </div>
108 <?php endif; ?>
109 <?php if ( $atts['progress_bar'] == true && defined( 'LEARNDASH_VERSION' ) ) : ?>
110 <?php if ( $post->post_type == 'sfwd-courses' ) : ?>
111 <?php echo do_shortcode( '[learndash_course_progress course_id="' . $post->ID . '" user_id="' . $user_id . '"]' ); ?>
112 <?php elseif ( $post->post_type == 'groups' ) : ?>
113 <div class="learndash-wrapper learndash-widget">
114 <?php $progress = learndash_get_user_group_progress( $post->ID, $user_id ); ?>
115 <?php learndash_get_template_part(
116 'modules/progress-group.php',
117 array(
118 'context' => 'group',
119 'user_id' => $user_id,
120 'group_id' => $post->ID,
121 ),
122 true
123 ); ?>
124 </div>
125 <?php endif; ?>
126 <?php endif; ?>
127 </div>
128 </article>
129 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .items-wrapper .list-2 .post {
2 display: flex;
3 flex-direction: row;
4 gap: 50px;
5 margin-bottom: 60px;
6 padding: 20px;
7 border-radius: 20px;
8 box-shadow: 3px 4px 4px 4px rgb(0 0 0 / 10%);
9 -moz-box-shadow: 3px 4px 4px 4px rgb(0 0 0 / 10%);
10 -webkit-box-shadow: 3px 4px 4px 4px rgb(0 0 0 / 10%);
11 }
12
13 .learndash-course-grid .items-wrapper .list-2 .ribbon {
14 text-shadow: 0 1px rgb( 0 0 0 / 30% );
15 position: absolute;
16 z-index: 2;
17 top: 0;
18 right: 0;
19 left: auto;
20 padding: 10px 12px;
21 color: #fff;
22 background: #f43e5e;
23 font-weight: bold;
24 font-size: 1rem;
25 border-radius: 5px;
26 display: flex;
27 align-items: center;
28 justify-content: center;
29 max-width: 20%;
30 }
31
32 .learndash-course-grid .items-wrapper .list-2 .thumbnail {
33 margin: 0;
34 padding: 0;
35 position: relative;
36 }
37
38 .learndash-course-grid .items-wrapper .list-2 .thumbnail .reviews {
39 position: absolute;
40 right: 24px;
41 top: 14px;
42 padding: 5px 10px;
43 display: flex;
44 gap: 5px;
45 align-items: center;
46 background: #ffb703;
47 color: #fff;
48 border-radius: 5px;
49 }
50
51 .learndash-course-grid .items-wrapper .list-2 .content .reviews {
52 margin-left: auto;
53 }
54
55 .learndash-course-grid .items-wrapper .list-2 .icon {
56 justify-content: center;
57 margin-right: 3px;
58 }
59
60 .learndash-course-grid .items-wrapper .list-2 .reviews .icon {
61 font-size: 1rem;
62 display: flex;
63 align-items: center;
64 color: #ffb703;
65 }
66
67 .learndash-course-grid .items-wrapper .list-2 .thumbnail > div {
68 height: 100%;
69 width: auto;
70 display: flex;
71 align-items: center;
72 }
73
74 .learndash-course-grid .items-wrapper .list-2 .thumbnail img {
75 margin: 0 auto;
76 padding: 0;
77 margin: 0 auto;
78 padding: 0;
79 height: 150px;
80 width: 150px;
81 max-width: initial;
82 border-radius: 20px;
83 }
84
85 .learndash-course-grid .items-wrapper .list-2 .thumbnail .arrow {
86 position: absolute;
87 right: 17px;
88 bottom: -18px;
89 }
90
91 .learndash-course-grid .items-wrapper .list-2 .arrow::after {
92 display: none;
93 }
94
95 .learndash-course-grid .items-wrapper .list-2 .thumbnail .arrow * {
96 text-decoration: none;
97 }
98
99 .learndash-course-grid .items-wrapper .list-2 .thumbnail .arrow .icon {
100 background: #fd9752;
101 color: #fff;
102 font-size: 25px;
103 width: auto;
104 height: auto;
105 padding: 5px;
106 border-radius: 100px;
107 }
108
109 .learndash-course-grid .items-wrapper .list-2 .content {
110 color: #333333;
111 position: relative;
112 width: 100%;
113 display: flex;
114 flex-direction: column;
115 }
116
117 .learndash-course-grid .items-wrapper .list-2 .content > .wrapper {
118 display: flex;
119 flex-wrap: wrap;
120 }
121
122 .learndash-course-grid .items-wrapper .list-2 .content .top-meta {
123 display: flex;
124 flex-wrap: wrap;
125 gap: 15px;
126 align-items: center;
127 font-size: 0.875rem;
128 }
129
130 .learndash-course-grid .items-wrapper .list-2 .content .categories {
131 color: #949ca1;
132 }
133
134 .learndash-course-grid .items-wrapper .list-2 .content .author {
135 color: #949ca1;
136 }
137
138 .learndash-course-grid .items-wrapper .list-2 .content .author .name {
139 font-weight: bold;
140 }
141
142 .learndash-course-grid .items-wrapper .list-2 .content .author .wrapper .lessons {
143 float: right;
144 }
145
146 .learndash-course-grid .items-wrapper .list-2 .content .meta {
147 display: flex;
148 gap: 15px;
149 font-size: 0.875rem;
150 color: #b1b2b2;
151 }
152
153 .learndash-course-grid .items-wrapper .list-2 .content .meta > div {
154 display: flex;
155 align-items: center;
156 }
157
158 .learndash-course-grid .items-wrapper .list-2 .content .meta .icon {
159 font-size: 1rem;
160 display: flex;
161 align-items: center;
162 }
163
164 .learndash-course-grid .items-wrapper .list-2 .content .meta .reviews {
165 gap: 5px;
166 }
167
168 .learndash-course-grid .items-wrapper .list-2 .content .meta .stars {
169 display: flex;
170 align-items: center;
171 }
172
173 .learndash-course-grid .items-wrapper .list-2 .content .bottom-meta {
174 margin-top: auto;
175 margin-bottom: 0;
176 }
177
178 .learndash-course-grid .items-wrapper .list-2 .content .title-wrapper {
179 margin-bottom: 25px;
180 max-width: 75%;
181 }
182
183 .learndash-course-grid .items-wrapper .list-2 .content .entry-title {
184 font-size: 1.4rem;
185 font-weight: bold;
186 line-height: 1.2;
187 color: #333;
188 margin-bottom: 10px;
189 }
190
191 .learndash-course-grid .items-wrapper .list-2 .content .entry-title a {
192 text-decoration: none;
193 color: #333;
194 font-size: 1.4rem;
195 line-height: 1.2;
196 font-weight: bold;
197 }
198
199 .learndash-course-grid .items-wrapper .list-2 .content .entry-content {
200 margin-bottom: 20px;
201 color: #b1b2b2;
202 font-size: 0.875rem;
203 }
204
205 .learndash-course-grid .items-wrapper .list-2 .content .entry-content > * {
206 margin: 0;
207 }
208
209 .learndash-course-grid .items-wrapper .list-2 .content .button {
210 background: none;
211 border: none;
212 padding: 0;
213 display: flex;
214 justify-content: space-between;
215 align-items: center;
216 }
217
218 .learndash-course-grid .items-wrapper .list-2 .content .button a {
219 background: none;
220 color: #a9aaaa;
221 text-decoration: none;
222 padding-bottom: 5px;
223 border-bottom: 2px solid #a9aaaa;
224 }
225
226 .learndash-course-grid .items-wrapper .list-2 .content .button a:hover {
227 color: #d5d6d6;
228 }
229
230 .learndash-course-grid .items-wrapper .list-2 .content .button .arrow {
231 background: #f6617b;
232 padding: 5px 10px;
233 color: #fff;
234 border-radius: 5px;
235
236 width: initial;
237 height: initial;
238 overflow: initial;
239 position: initial;
240 margin: initial
241 }
242
243 .learndash-course-grid .items-wrapper .list-2 .content .button .arrow a {
244 text-decoration: none;
245 color: #fff;
246 border: none;
247 padding: 0;
248 display: flex;
249 align-items: center;
250 }
251
252 @media only screen and ( max-width: 768px ) {
253 .learndash-course-grid .items-wrapper .list-2 .post {
254 flex-direction: column;
255 gap: 25px;
256 }
257
258 .learndash-course-grid .items-wrapper .list-2 .thumbnail {
259 width: 100%;
260 }
261
262 .learndash-course-grid .items-wrapper .list-2 .thumbnail > div {
263 display: initial;
264 }
265
266 .learndash-course-grid .items-wrapper .list-2 .thumbnail img {
267 width: 100%;
268 height: auto;
269 }
270
271 .learndash-course-grid .items-wrapper .list-2 .content {
272 width: 100%;
273 }
274
275 .learndash-course-grid .items-wrapper .list-2 .content .title-wrapper {
276 margin-bottom: 10px;
277 }
278
279 .learndash-course-grid .items-wrapper .list-2 .content .meta {
280 flex-wrap: wrap;
281 }
282
283 .learndash-course-grid .items-wrapper .list-2 .content .ribbon {
284 display: none;
285 }
286 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 use LearnDash\Course_Grid\Utilities;
3 ?>
4
5 <div class="filter-wrapper">
6 <form method="POST" name="learndash_course_grid_filter">
7 <?php wp_nonce_field( 'ld_cg_apply_filter' ); ?>
8 <?php if ( $atts['search'] == true ) : ?>
9 <div class="filter search">
10 <label for="search-<?php echo esc_attr( $atts['course_grid_id'] ); ?>"><?php _e( 'Keyword', 'learndash-course-grid' ); ?></label>
11 <input type="text" name="search" id="search-<?php echo esc_attr( $atts['course_grid_id'] ); ?>">
12 </div>
13 <?php endif; ?>
14
15 <?php if ( ! empty( $atts['taxonomies'] ) ) : ?>
16 <div class="filter taxonomies">
17 <div class="taxonomies-wrapper">
18 <?php foreach ( $atts['taxonomies'] as $taxonomy ) : ?>
19 <?php
20
21 $tax_object = get_taxonomy( $taxonomy );
22
23 if ( is_a( $tax_object, 'WP_Taxonomy' ) ) :
24 $terms = get_terms( [
25 'taxonomy' => $taxonomy,
26 'orderby' => 'name',
27 'order' => 'ASC',
28 'hide_empty' => false,
29 ] );
30
31 ?>
32
33 <div class="taxonomy <?php echo esc_attr( $taxonomy ); ?>">
34 <label><?php echo esc_html( $tax_object->labels->name ); ?></label>
35 <ul class="terms">
36 <?php foreach ( $terms as $term ) : ?>
37 <li class="term">
38 <label
39 for="<?php echo esc_attr( $atts['course_grid_id'] ) . '-' . esc_attr( $taxonomy ) . '-' . esc_attr( $term->slug ); ?>"
40 >
41 <input
42 id="<?php echo esc_attr( $atts['course_grid_id'] ) . '-' . esc_attr( $taxonomy ) . '-' . esc_attr( $term->slug ); ?>"
43 type="checkbox"
44 name="<?php echo esc_attr( $taxonomy ); ?>[]"
45 value="<?php echo esc_attr( $term->term_id ); ?>"
46 <?php Utilities::checked_array( @$term->slug, @$default_taxonomies[ $taxonomy ]['terms'], true ); ?>
47 >
48 <?php echo esc_html( $term->name ) ?>
49 </label>
50 </li>
51 <?php endforeach; ?>
52 </ul>
53 </div>
54 <?php endif; ?>
55 <?php endforeach; ?>
56 </div>
57 </div>
58 <?php endif; ?>
59
60 <?php if ( $atts['price'] == true ) : ?>
61 <div class="filter price">
62 <label><?php _e( 'Price', 'learndash-course-grid' ); ?></label>
63 <div class="range-wrapper">
64 <input name="price_min_range" class="range" id="price_min_range-<?php echo esc_attr( $atts['course_grid_id'] ); ?>" type="range" min="<?php echo esc_attr( $atts['price_min' ] ); ?>" max="<?php echo esc_attr( $atts['price_max' ] / 2 ); ?>" step="<?php echo esc_attr( $atts['price_step' ] ); ?>">
65 <input name="price_max_range" class="range" id="price_max_range-<?php echo esc_attr( $atts['course_grid_id'] ); ?>" type="range" min="<?php echo esc_attr( $atts['price_max' ] / 2 ); ?>" max="<?php echo esc_attr( $atts['price_max' ] ); ?>" step="<?php echo esc_attr( $atts['price_step' ] ); ?>">
66 <div style="clear: both;"></div>
67 </div>
68 <div class="number-wrapper left">
69 <label for="price_min-<?php echo esc_attr( $atts['course_grid_id'] ); ?>"><?php _ex( 'Min', 'Minimum', 'learndash-course-grid' ); ?></label>
70 <input type="number" name="price_min" id="price_min-<?php echo esc_attr( $atts['course_grid_id'] ); ?>" min="<?php echo esc_attr( $atts['price_min' ] ); ?>" step="<?php echo esc_attr( $atts['price_step' ] ); ?>">
71 </div>
72 <div class="number-wrapper right">
73 <label for="price_max-<?php echo esc_attr( $atts['course_grid_id'] ); ?>"><?php _ex( 'Max', 'Maximum', 'learndash-course-grid' ); ?></label>
74 <input type="number" name="price_max" id="price_max-<?php echo esc_attr( $atts['course_grid_id'] ); ?>" max="<?php echo esc_attr( $atts['price_max' ] ); ?>" step="<?php echo esc_attr( $atts['price_step' ] ); ?>">
75 </div>
76 <div style="clear: both;"></div>
77 </div>
78 <?php endif; ?>
79
80 <div class="buttons">
81 <button class="button apply blue"><?php _e( 'Apply', 'learndash-course-grid' ); ?></button>
82 <button class="button clear grey"><?php _e( 'Clear', 'learndash-course-grid' ); ?></button>
83 </div>
84 </form>
85 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .toggle-filter {
2 position: sticky;
3 left: 100%;
4 margin-bottom: 20px;
5 }
6
7 .toggle-filter.opened::before {
8 content: "\f158";
9 font-family: 'Dashicons';
10 padding-right: 10px;
11 top: 1px;
12 position: relative;
13 }
14
15 .learndash-course-grid {
16 position: relative;
17 }
18
19 .learndash-course-grid .learndash-course-grid-filter {
20 position: absolute;
21 max-width: 300px;
22 }
23
24 .learndash-course-grid .learndash-course-grid-filter {
25 display: none;
26 }
27
28 .learndash-course-grid-filter {
29 max-width: 300px;
30 min-width: 300px;
31 background: white;
32 padding: 15px 20px;
33 border-radius: 5px;
34 z-index: 2000;
35 margin: 0 auto;
36 border: 2px solid #ddd;
37 }
38
39 .learndash-course-grid .learndash-course-grid-filter {
40 right: 0;
41 position: absolute;
42 }
43
44 .learndash-course-grid-filter form {
45 margin: 0;
46 }
47
48 .learndash-course-grid-filter form input:focus,
49 .learndash-course-grid-filter form select:focus {
50 outline: none;
51 }
52
53 /* Range Input */
54
55 .learndash-course-grid-filter form input[type=range] {
56 -webkit-appearance: none;
57 margin: 18px 0;
58 width: 100%;
59 }
60
61 .learndash-course-grid-filter form input[type=range]:focus {
62 outline: none;
63 }
64
65 .learndash-course-grid-filter form input[type=range]::-webkit-slider-runnable-track {
66 width: 100%;
67 height: 8.4px;
68 cursor: pointer;
69 background: #0077ff;
70 border-radius: 1.3px;
71 }
72
73 .learndash-course-grid-filter form input[type="range"]:first-child::-webkit-slider-runnable-track {
74 border-top-left-radius: 10px;
75 border-bottom-left-radius: 10px;
76 border-right: none;
77 }
78
79 .learndash-course-grid-filter form input[type="range"]:nth-child(2)::-webkit-slider-runnable-track {
80 border-top-right-radius: 10px;
81 border-bottom-right-radius: 10px;
82 border-left: none;
83 }
84
85 .learndash-course-grid-filter form input[type=range]::-webkit-slider-thumb {
86 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
87 border: 1px solid #000000;
88 height: 16px;
89 width: 16px;
90 border-radius: 10px;
91 background: #ffffff;
92 cursor: pointer;
93 -webkit-appearance: none;
94 margin-top: -5px;
95 }
96
97 .learndash-course-grid-filter form input[type=range]:focus::-webkit-slider-runnable-track {
98 background: #0077ff;
99 }
100
101 .learndash-course-grid-filter form input[type=range]::-moz-range-track {
102 width: 100%;
103 height: 8.4px;
104 cursor: pointer;
105 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
106 background: #0077ff;
107 border-radius: 1.3px;
108 border: 0.2px solid #010101;
109 }
110
111 .learndash-course-grid-filter form input[type=range]::-moz-range-thumb {
112 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
113 border: 1px solid #000000;
114 height: 16px;
115 width: 16px;
116 border-radius: 10px;
117 background: #ffffff;
118 cursor: pointer;
119 }
120
121 .learndash-course-grid-filter form input[type=range]::-ms-track {
122 width: 100%;
123 height: 8.4px;
124 cursor: pointer;
125 background: transparent;
126 border-color: transparent;
127 border-width: 16px 0;
128 color: transparent;
129 }
130
131 .learndash-course-grid-filter form input[type=range]::-ms-fill-lower {
132 background: #2a6495;
133 border: 0.2px solid #010101;
134 border-radius: 2.6px;
135 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
136 }
137
138 .learndash-course-grid-filter form input[type=range]::-ms-fill-upper {
139 background: #0077ff;
140 border: 0.2px solid #010101;
141 border-radius: 2.6px;
142 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
143 }
144
145 .learndash-course-grid-filter form input[type=range]::-ms-thumb {
146 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
147 border: 1px solid #000000;
148 height: 16px;
149 width: 16px;
150 border-radius: 10px;
151 background: #ffffff;
152 cursor: pointer;
153 }
154
155 .learndash-course-grid-filter form input[type=range]:focus::-ms-fill-lower {
156 background: #0077ff;
157 }
158
159 .learndash-course-grid-filter form input[type=range]:focus::-ms-fill-upper {
160 background: #0077ff;
161 }
162
163 /* End Range Input */
164
165 .learndash-course-grid-filter .filter {
166 margin-bottom: 15px;
167 }
168
169 .learndash-course-grid-filter .taxonomies-wrapper .terms {
170 list-style-type: none;
171 padding: 0 0 15px 20px;
172 margin: 0;
173 max-height: 150px;
174 overflow: auto;
175 }
176
177 .learndash-course-grid-filter .filter.price label {
178 display: block;
179 }
180
181 /* .learndash-course-grid-filter .filter.price .range-wrapper {
182 position: relative;
183 left: 8px;
184 } */
185
186 .learndash-course-grid-filter .filter.price .range-wrapper :first-child {
187 width: 50%;
188 float: left;
189 }
190
191 .learndash-course-grid-filter .filter.price .range-wrapper :nth-child(2) {
192 width: 50%;
193 float: right;
194 }
195
196 .learndash-course-grid-filter .filter.price .number-wrapper.left {
197 float: left;
198 text-align: left;
199 }
200
201 .learndash-course-grid-filter .filter.price .number-wrapper.right {
202 float: right;
203 text-align: right;
204 }
205
206 .learndash-course-grid-filter .filter.price .number-wrapper label,
207 .learndash-course-grid-filter .filter.price .number-wrapper input {
208 display: block;
209 }
210
211 .learndash-course-grid-filter .filter.price .number-wrapper input {
212 width: 80px;
213 }
214
215 .learndash-course-grid-filter .filter.price input[type="range"] {
216 margin-bottom: 10px;
217 }
218
219 .learndash-course-grid-filter input[type="text"],
220 .learndash-course-grid-filter input[type="range"] {
221 display: block;
222 width: 100%;
223 }
224
225 .learndash-course-grid-filter input[type="text"] {
226 padding: 5px;
227 }
228
229 .learndash-course-grid-filter .buttons {
230 margin-top: 0;
231 }
232
233 .toggle-filter,
234 .learndash-course-grid-filter .buttons .button {
235 display: block;
236 margin-bottom: 10px;
237 border-radius: 3px;
238 padding: 0.5rem 1rem;
239 font-weight: 600;
240 text-decoration: none;
241 font-size: 1rem;
242 border: 3px solid #ddd;
243 -webkit-transition: all 0.3s ease;
244 transition: all 0.3s ease;
245 text-align: center;
246 display: -ms-flexbox;
247 display: flex;
248 justify-content: center;
249 -ms-flex-align: center;
250 align-items: center;
251 cursor: pointer;
252 }
253
254 .learndash-course-grid-filter .buttons .button {
255 width: 100%;
256 }
257
258 .learndash-course-grid-filter .buttons .button.blue {
259 color: #ffffff;
260 background-color: #235af4;
261 border-color: #235af4;
262 }
263
264 .learndash-course-grid-filter .buttons .button.blue:hover {
265 background: #0d9dff;
266 border-color: #0d9dff;
267 }
268
269 .toggle-filter,
270 .learndash-course-grid-filter .buttons .button.grey {
271 color: #333333;
272 background-color: #eeeeee;
273 border-color: #eeeeee;
274 }
275
276 .toggle-filter:hover,
277 .learndash-course-grid-filter .buttons .button.grey:hover {
278 background-color: #d5d5d5;
279 border-color: #d5d5d5;
280 }
...\ No newline at end of file ...\ No newline at end of file
1 <div class="pagination">
2 <button class="load-more"><?php _e( 'Load More', 'learndash-course-grid' ) ?></button>
3 </div>
...\ No newline at end of file ...\ No newline at end of file
1 <div class="pagination">
2
3 </div>
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .pagination {
2 text-align: center;
3 border: 0;
4 margin: 0;
5 padding: 0;
6 }
7
8 .learndash-course-grid .pagination::before,
9 .learndash-course-grid .pagination::after {
10 display: none;
11 }
12
13 .learndash-course-grid .pagination .load-more {
14 margin: 0 auto;
15 border-radius: 3px;
16 background-color: #fd6703;
17 color: #ffffff;
18 padding: 10px 50px;
19 padding: 0.75rem 2rem;
20 font-weight: 600;
21 text-decoration: none;
22 font-size: 1.4rem;
23 border: 3px solid #fd6703;
24 -webkit-transition: all 0.3s ease;
25 transition: all 0.3s ease;
26 text-align: center;
27 display: -webkit-box;
28 display: -ms-flexbox;
29 display: flex;
30 -webkit-box-pack: center;
31 -ms-flex-pack: center;
32 justify-content: center;
33 -webkit-box-align: center;
34 -ms-flex-align: center;
35 align-items: center;
36 cursor: pointer;
37 }
38
39 .learndash-course-grid .pagination .load-more:hover {
40 background-color: #f7883e;
41 border-color: #f7883e;
42 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * Available variables:
4 *
5 * $posts Array of WP_Post objects, result of the WP_Query->get_posts()
6 * $atts Shortcode/Block editor attributes that call this template
7 */
8 ?>
9 <div class="items-wrapper <?php echo esc_attr( $atts['skin'] ); ?>">
10 <?php foreach ( $posts as $post ) : ?>
11 <?php learndash_course_grid_load_card_template( $atts, $post ); ?>
12 <?php endforeach; ?>
13 </div>
...\ No newline at end of file ...\ No newline at end of file
1 /**
2 * Responsive design
3 */
4 function learndash_course_grid_init_grid_responsive_design() {
5 const wrappers = document.querySelectorAll( '.learndash-course-grid[data-skin="grid"]' );
6
7 wrappers.forEach( function( wrapper ) {
8 const items_wrapper = wrapper.querySelector( '.items-wrapper.grid' );
9
10 if ( ! items_wrapper ) {
11 return;
12 }
13
14 const first_item = items_wrapper.firstElementChild;
15
16 if ( ! first_item ) {
17 return;
18 }
19
20 // Set columns
21 const min_width = wrapper.dataset.min_column_width;
22
23 let columns = wrapper.dataset.columns;
24 columns = parseInt( columns );
25 let new_columns = wrapper.dataset.new_columns || columns;
26 new_columns = parseInt( new_columns );
27
28 const wrapper_width = wrapper.offsetWidth;
29 let upper_columns = new_columns + 1;
30 upper_columns = upper_columns > columns ? columns : upper_columns;
31 const min_item_width = wrapper_width / upper_columns;
32
33 new_columns = Math.floor( wrapper_width / min_width );
34
35 let item_width = first_item.offsetWidth;
36
37 if ( item_width < min_width ) {
38 new_columns = new_columns > columns ? columns : new_columns;
39 new_columns = new_columns < 1 ? 1 : new_columns;
40 wrapper.dataset.new_columns = new_columns;
41 items_wrapper.style.gridTemplateColumns = 'repeat( ' + new_columns + ', minmax( 0, 1fr ) )';
42 } else if ( min_item_width > min_width ) {
43 new_columns = new_columns > columns ? columns : new_columns;
44 new_columns = new_columns < 1 ? 1 : new_columns;
45 wrapper.dataset.new_columns = new_columns;
46 items_wrapper.style.gridTemplateColumns = 'repeat( ' + new_columns + ', minmax( 0, 1fr ) )';
47 }
48
49 const items = items_wrapper.querySelectorAll( '.item' );
50 items.forEach( function( item ) {
51 // Display item
52 item.style.visibility = 'visible';
53 } );
54 } );
55 }
56
57 ( function() {
58 window.addEventListener( 'resize', function() {
59 learndash_course_grid_init_grid_responsive_design();
60 } );
61
62 window.addEventListener( 'load', function() {
63 learndash_course_grid_init_grid_responsive_design();
64 } );
65 } )();
1 .learndash-course-grid .items-wrapper.grid {
2 display: grid;
3 grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
4 column-gap: 30px;
5 row-gap: 30px;
6 margin-bottom: 30px;
7 }
8
9 .learndash-course-grid .items-wrapper.grid .item {
10 visibility: hidden;
11 }
12
13 .learndash-course-grid .items-wrapper.grid .item .content .entry-content {
14 float: none;
15 margin: auto;
16 width: auto;
17 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package nmbs
4 */
5 $col = empty( $shortcode_atts['col'] ) ? LEARNDASH_COURSE_GRID_COLUMNS : intval( $shortcode_atts['col'] );
6 $col = $col > 6 ? 6 : $col;
7 $smcol = $col == 1 ? 1 : $col / 2;
8 $col = 12 / $col;
9 $smcol = intval( ceil( 12 / $smcol ) );
10 $col = is_float( $col ) ? number_format( $col, 1 ) : $col;
11 $col = str_replace( '.', '-', $col );
12
13 global $post; $post_id = $post->ID;
14
15 $post_atts = learndash_course_grid_prepare_template_post_attributes( $post, [], $shortcode_atts );
16
17 extract( $post_atts );
18
19 $post_type = get_post_type( $post->ID );
20
21 $course_id = $post_id;
22 $user_id = get_current_user_id();
23
24 // Retrive oembed HTML if URL provided
25 if ( preg_match( '/^http/', $video_embed_code ) ) {
26 $video_embed_code = wp_oembed_get( $video_embed_code, array( 'height' => 600, 'width' => 400 ) );
27 }
28
29 $course_options = get_post_meta( $post_id, "_sfwd-courses", true );
30
31 /**
32 * Filter: individual grid class
33 *
34 * @param int $course_id Course ID
35 * @param array $course_options Course options
36 * @var string
37 */
38 $grid_class = apply_filters( 'learndash_course_grid_class', '', $course_id, $course_options );
39
40 $course_class = apply_filters( 'learndash_course_grid_course_class', '', $course_id, $course_options );
41
42 $thumb_size = isset( $shortcode_atts['thumb_size'] ) && ! empty( $shortcode_atts['thumb_size'] ) ? $shortcode_atts['thumb_size'] : 'medium';
43
44 ob_start();
45 ?>
46 <div class="ld_course_grid col-sm-<?php echo $smcol; ?> col-md-<?php echo $col; ?> <?php echo esc_attr( $grid_class ); ?>">
47 <article id="post-<?php the_ID(); ?>" <?php post_class( $course_class . ' thumbnail course' ); ?>>
48 <?php if ( $shortcode_atts['show_thumbnail'] == 'true' ) : ?>
49 <?php if ( ! empty( $ribbon_text ) ) : ?>
50 <div class="<?php echo esc_attr( $ribbon_class ); ?>">
51 <?php echo wp_kses_post( $ribbon_text ); ?>
52 </div>
53 <?php endif; ?>
54
55 <?php if ( 1 == $video && ! empty( $video_embed_code ) ) : ?>
56 <div class="ld_course_grid_video_embed">
57 <?php echo $video_embed_code; ?>
58 </div>
59 <?php elseif( has_post_thumbnail() ) :?>
60 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
61 <?php the_post_thumbnail( $thumb_size ); ?>
62 </a>
63 <?php else : ?>
64 <a href="<?php echo esc_url( $button_link ); ?>" rel="bookmark">
65 <img alt="" src="<?php echo LEARNDASH_COURSE_GRID_PLUGIN_ASSET_URL . 'img/thumbnail.jpg'; ?>"/>
66 </a>
67 <?php endif;?>
68 <?php endif; ?>
69
70 <?php if ( $shortcode_atts['show_content'] == 'true' ) : ?>
71 <div class="caption">
72 <h3 class="entry-title"><?php the_title(); ?></h3>
73 <?php if ( ! empty( $description ) ) : ?>
74 <div class="entry-content"><?php echo do_shortcode( htmlspecialchars_decode( $description ) ); ?></div>
75 <?php endif; ?>
76 <div class="ld_course_grid_button"><a class="btn btn-primary" role="button" href="<?php echo esc_url( $button_link ); ?>" rel="bookmark"><?php echo esc_attr( $button_text ); ?></a></div>
77 <?php if ( isset( $shortcode_atts['progress_bar'] ) && $shortcode_atts['progress_bar'] == 'true' ) : ?>
78 <?php if ( $post_type == 'sfwd-courses' ) : ?>
79 <?php echo do_shortcode( '[learndash_course_progress course_id="' . get_the_ID() . '" user_id="' . get_current_user_id() . '"]' ); ?>
80 <?php elseif ( $post_type == 'groups' ) : ?>
81 <div class="learndash-wrapper learndash-widget">
82 <?php $progress = learndash_get_user_group_progress( $post_id, $user_id ); ?>
83 <?php learndash_get_template_part(
84 'modules/progress-group.php',
85 array(
86 'context' => 'group',
87 'user_id' => $user_id,
88 'group_id' => $post_id,
89 ),
90 true
91 ); ?>
92 </div>
93 <?php endif; ?>
94 <?php endif; ?>
95 </div><!-- .entry-header -->
96 <?php endif; ?>
97 </article><!-- #post-## -->
98 </div><!-- .ld_course_grid -->
99 <?php
100 /**
101 * Tag to detect if v1 course grid exists on a page
102 *
103 * Make sure to include this tag when using custom template or modify the template via filter hook.
104 */
105 $tag = '<!-- LearnDash Course Grid v1 -->';
106
107 /**
108 * Filter: course grid HTML output
109 *
110 * @param string $output Individual course grid HTML output
111 * @param object $post LD course WP_Post object
112 * @param array $shortcode_atts Shortcode attributes used for this course grid output
113 * @param int $user_id Current user ID this course grid is displayed to
114 * @return string Filtered course grid HTML output
115 */
116 echo apply_filters( 'learndash_course_grid_html_output', $tag . ob_get_clean(), $post, $shortcode_atts, $user_id );
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * Available variables:
4 *
5 * $posts Array of WP_Post objects, result of the WP_Query->get_posts()
6 * $atts Shortcode/Block editor attributes that call this template
7 */
8 ?>
9 <div class="items-wrapper <?php echo esc_attr( $atts['skin'] ); ?>">
10 <?php foreach ( $posts as $post ) : ?>
11 <?php learndash_course_grid_load_card_template( $atts, $post ); ?>
12 <?php endforeach; ?>
13 </div>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * Available variables:
4 *
5 * $posts Array of WP_Post objects, result of the WP_Query->get_posts()
6 * $atts Shortcode/Block editor attributes that call this template
7 */
8 ?>
9 <div class="items-wrapper <?php echo esc_attr( $atts['skin'] ); ?>">
10 <?php foreach ( $posts as $post ) : ?>
11 <?php learndash_course_grid_load_card_template( $atts, $post ); ?>
12 <?php endforeach; ?>
13 </div>
...\ No newline at end of file ...\ No newline at end of file
1 function learndash_course_grid_init_masonry( items_wrapper ) {
2 const course_grid = items_wrapper.closest( '.learndash-course-grid' );
3 const columns = parseInt( course_grid.dataset.columns );
4 const min_width = parseInt( course_grid.dataset.min_column_width );
5
6 const width = items_wrapper.offsetWidth;
7 const items = items_wrapper.querySelectorAll( '.item' );
8
9 if ( items.length < 1 ) {
10 return;
11 }
12
13 const padding = 10;
14
15 let max_columns = Math.floor( width / min_width );
16 max_columns = max_columns > columns ? columns : max_columns;
17
18 items.forEach( function( item ) {
19 item.style.padding = padding + 'px';
20 item.style.maxWidth = ( width / max_columns ) + 'px';
21 item.style.width = ( width / max_columns ) + 'px';
22
23 item.style.visibility = 'visible';
24 } );
25
26 const masonry = new Masonry( items_wrapper, {
27 itemSelector: '.item',
28 fitWidth: true,
29 horizontalOrder: true,
30 } );
31 }
32
33 function learndash_course_grid_init_masonry_responsive_design() {
34 const wrappers = document.querySelectorAll( '.learndash-course-grid[data-skin="masonry"]' );
35 wrappers.forEach( function( wrapper ) {
36 const items_wrapper = wrapper.querySelector( '.items-wrapper.masonry' );
37
38 learndash_course_grid_init_masonry( items_wrapper );
39 } );
40 }
41
42 ( function() {
43 window.addEventListener( 'resize', function() {
44 learndash_course_grid_init_masonry_responsive_design();
45 } );
46
47 window.addEventListener( 'load', function() {
48 learndash_course_grid_init_masonry_responsive_design();
49 } );
50 } )();
...\ No newline at end of file ...\ No newline at end of file
1 .learndash-course-grid .masonry {
2 display: grid;
3 grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
4 column-gap: 30px;
5 row-gap: 30px;
6 margin: 0 auto;
7 margin-bottom: 30px;
8 width: 100% !important;
9 }
10
11 .learndash-course-grid .items-wrapper.masonry .item {
12 visibility: hidden;
13 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 // autoload.php @generated by Composer
4
5 require_once __DIR__ . '/composer/autoload_real.php';
6
7 return ComposerAutoloaderInitddfc61f6647a593b58a61b47a842cf39::getLoader();
1
2 Copyright (c) Nils Adermann, Jordi Boggiano
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is furnished
9 to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21
1 <?php
2
3 // autoload_classmap.php @generated by Composer
4
5 $vendorDir = dirname(dirname(__FILE__));
6 $baseDir = dirname($vendorDir);
7
8 return array(
9 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10 );
1 <?php
2
3 // autoload_namespaces.php @generated by Composer
4
5 $vendorDir = dirname(dirname(__FILE__));
6 $baseDir = dirname($vendorDir);
7
8 return array(
9 );
1 <?php
2
3 // autoload_psr4.php @generated by Composer
4
5 $vendorDir = dirname(dirname(__FILE__));
6 $baseDir = dirname($vendorDir);
7
8 return array(
9 );
1 <?php
2
3 // autoload_real.php @generated by Composer
4
5 class ComposerAutoloaderInitddfc61f6647a593b58a61b47a842cf39
6 {
7 private static $loader;
8
9 public static function loadClassLoader($class)
10 {
11 if ('Composer\Autoload\ClassLoader' === $class) {
12 require __DIR__ . '/ClassLoader.php';
13 }
14 }
15
16 /**
17 * @return \Composer\Autoload\ClassLoader
18 */
19 public static function getLoader()
20 {
21 if (null !== self::$loader) {
22 return self::$loader;
23 }
24
25 spl_autoload_register(array('ComposerAutoloaderInitddfc61f6647a593b58a61b47a842cf39', 'loadClassLoader'), true, true);
26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27 spl_autoload_unregister(array('ComposerAutoloaderInitddfc61f6647a593b58a61b47a842cf39', 'loadClassLoader'));
28
29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30 if ($useStaticLoader) {
31 require __DIR__ . '/autoload_static.php';
32
33 call_user_func(\Composer\Autoload\ComposerStaticInitddfc61f6647a593b58a61b47a842cf39::getInitializer($loader));
34 } else {
35 $map = require __DIR__ . '/autoload_namespaces.php';
36 foreach ($map as $namespace => $path) {
37 $loader->set($namespace, $path);
38 }
39
40 $map = require __DIR__ . '/autoload_psr4.php';
41 foreach ($map as $namespace => $path) {
42 $loader->setPsr4($namespace, $path);
43 }
44
45 $classMap = require __DIR__ . '/autoload_classmap.php';
46 if ($classMap) {
47 $loader->addClassMap($classMap);
48 }
49 }
50
51 $loader->register(true);
52
53 return $loader;
54 }
55 }
1 <?php
2
3 // autoload_static.php @generated by Composer
4
5 namespace Composer\Autoload;
6
7 class ComposerStaticInitddfc61f6647a593b58a61b47a842cf39
8 {
9 public static $classMap = array (
10 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
11 );
12
13 public static function getInitializer(ClassLoader $loader)
14 {
15 return \Closure::bind(function () use ($loader) {
16 $loader->classMap = ComposerStaticInitddfc61f6647a593b58a61b47a842cf39::$classMap;
17
18 }, null, ClassLoader::class);
19 }
20 }
1 {
2 "packages": [],
3 "dev": false,
4 "dev-package-names": []
5 }
1 <?php return array(
2 'root' => array(
3 'pretty_version' => 'dev-master',
4 'version' => 'dev-master',
5 'type' => 'library',
6 'install_path' => __DIR__ . '/../../',
7 'aliases' => array(),
8 'reference' => '92dc9ed3efd0f92db72ec19dfc782b02b69b1dac',
9 'name' => '__root__',
10 'dev' => false,
11 ),
12 'versions' => array(
13 '__root__' => array(
14 'pretty_version' => 'dev-master',
15 'version' => 'dev-master',
16 'type' => 'library',
17 'install_path' => __DIR__ . '/../../',
18 'aliases' => array(),
19 'reference' => '92dc9ed3efd0f92db72ec19dfc782b02b69b1dac',
20 'dev_requirement' => false,
21 ),
22 ),
23 );
1 .wp-admin .media-toolbar-secondary select {
2 margin: 11px 16px 0 0;
3 }
4
5 .media-term-section {
6 margin: 0 0 20px;
7 }
8
9 .media-terms {
10 background: #fff;
11 border: 1px solid #dfdfdf;
12 border-radius: 3px;
13 max-height: 145px;
14 overflow: auto;
15 padding: 6px 8px;
16 }
17
18 .wp-admin .media-terms label {
19 display: block;
20 }
21
22 .wp-admin .media-terms input[type="checkbox"] {
23 margin: 0 5px 0 0;
24 position: relative;
25 top: -1px;
26 width: auto;
27 }
28
29 .media-terms ul ul {
30 padding: 10px 0 5px 10px;
31 }
32
33 .media-terms ul li:last-child {
34 margin: 0;
35 }
36
37
38 .add-new-term {
39 display: none;
40 }
41
42 .media-save-terms {
43 position: relative;
44 }
45
46 .media-save-terms:before {
47 background: url( '../images/saving.gif ') no-repeat #fff;
48 content: '';
49 display: block;
50 height: 16px;
51 position: absolute;
52 right: 5px;
53 top: 5px;
54 width: 16px
55 }
56
57 .media-save-terms label {
58 opacity: .5
59 }
60
61 /* Add new media term */
62 .toggle-add-media-term {
63 display: inline-block;
64 margin: 5px 0;
65 }
66
67 .toggle-add-media-term:before {
68 content: '+ ';
69 }
70
71 .add-new-term {
72 margin: 0 0 5px;
73 }
74
1 jQuery(document).ready(function(){
2
3 var media = wp.media;
4
5 /*
6 // for debug : trace every event triggered in the Region controller
7 var originalTrigger = wp.media.view.MediaFrame.prototype.trigger;
8 wp.media.view.MediaFrame.prototype.trigger = function(){
9 console.log('MediaFrame Event: ', arguments[0]);
10 originalTrigger.apply(this, Array.prototype.slice.call(arguments));
11 }; //
12
13 // for Network debug
14 var originalAjax = media.ajax;
15 media.ajax = function( action ) {
16 console.log( 'media.ajax: action = ' + JSON.stringify( action ) );
17 return originalAjax.apply(this, Array.prototype.slice.call(arguments));
18 };
19 */
20
21 /**
22 * Extended Filters dropdown with taxonomy term selection values
23 */
24 if ( media ) {
25 jQuery.each(mediaTaxonomies,function(key,label){
26
27 media.view.AttachmentFilters[key] = media.view.AttachmentFilters.extend({
28 className: key,
29
30 createFilters: function() {
31 var filters = {};
32
33 _.each( mediaTerms[key] || {}, function( term ) {
34
35 var query = {};
36
37 query[key] = {
38 taxonomy: key,
39 term_id: parseInt( term.id, 10 ),
40 term_slug: term.slug
41 };
42
43 filters[ term.slug ] = {
44 text: term.label,
45 props: query
46 };
47 });
48
49 this.filters = filters;
50 }
51
52
53 });
54
55 /**
56 * Replace the media-toolbar with our own
57 */
58 var myDrop = media.view.AttachmentsBrowser;
59
60 media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({
61 createToolbar: function() {
62
63 media.model.Query.defaultArgs.filterSource = 'filter-media-taxonomies';
64
65 myDrop.prototype.createToolbar.apply(this,arguments);
66
67 this.toolbar.set( key, new media.view.AttachmentFilters[key]({
68 controller: this.controller,
69 model: this.collection.props,
70 priority: -80
71 }).render()
72 );
73 }
74 });
75
76 });
77 }
78
79 /* Save taxonomy */
80 jQuery('html').delegate( '.media-terms input', 'change', function(){
81
82 var obj = jQuery(this),
83 container = obj.parents('.media-terms'),
84 row = container.parent(),
85 data = {
86 action: 'save-media-terms',
87 term_ids: [],
88 attachment_id: container.data('id'),
89 taxonomy: container.data('taxonomy')
90 };
91
92 container.find('input:checked').each(function(){
93 data.term_ids.push( jQuery(this).val() );
94 });
95
96 row.addClass('media-save-terms');
97 container.find('input').prop('disabled', 'disabled');
98
99 jQuery.post( ajaxurl, data, function( response ){
100 row.removeClass('media-save-terms');
101 container.find('input').removeProp('disabled');
102 });
103
104 });
105
106 // Add new taxonomy
107 jQuery('html').delegate('.toggle-add-media-term', 'click', function(e){
108 e.preventDefault();
109 jQuery(this).parent().find('.add-new-term').toggle();
110 });
111
112 // Save new taxnomy
113 jQuery('html').delegate('.save-media-term', 'click', function(e){
114
115 var obj = jQuery(this),
116 termField = obj.parent().find('input'),
117 termParent = obj.parent().find('select'),
118 data = {
119 action: 'add-media-term',
120 attachment_id: obj.data('id'),
121 taxonomy: obj.data('taxonomy'),
122 parent: termParent.val(),
123 term: termField.val()
124 };
125
126 // No val
127 if ( '' == data.term ) {
128 termField.focus();
129 return;
130 }
131
132 jQuery.post(ajaxurl, data, function(response){
133
134 obj.parents('.field').find('.media-terms ul:first').html( response.checkboxes );
135 obj.parents('.field').find('select').replaceWith( response.selectbox );
136
137 console.log( response );
138
139 termField.val('');
140
141 }, 'json' );
142
143 });
144
145 });