course_navigation_widget.php
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Displays the course navigation widget.
*
* @since 2.1.0
*
* @package LearnDash\Templates\Legacy\Widgets
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Filter to allow override of widget instance arguments.
*
* @since 2.3.3
*/
if ( ! isset( $widget_instance ) ) {
$widget_instance = array();
}
/** This filter is documented in themes/ld30/templates/widgets/course-navigation.php */
$widget_instance = apply_filters( 'learndash_course_navigation_widget_args', $widget_instance, $course_id );
$widget_data = array(
'course_id' => $course_id,
'widget_instance' => $widget_instance,
);
$widget_data_json = htmlspecialchars( wp_json_encode( $widget_data ) );
if ( $widget_instance['show_widget_wrapper'] != false ) {
?>
<div id="course_navigation" class="course_navigation" data-widget_instance="<?php echo $widget_data_json; ?>">
<div class="ld-course-navigation-widget-content-contaiiner">
<?php
}
$template_file = SFWD_LMS::get_template(
'course_navigation_widget_rows',
null,
null,
true
);
if ( ! empty( $template_file ) ) {
include $template_file;
}
if ( ( ! empty( $widget_instance['current_step_id'] ) ) && ( $widget_instance['current_step_id'] != $course->ID ) ) {
?>
<div class="widget_course_return">
<?php esc_html_e( 'Return to', 'learndash' ); ?>
<a href='<?php echo esc_url( get_permalink( $course_id ) ); ?>'><?php echo $course->post_title; ?></a>
</div>
<?php
}
if ( $widget_instance['show_widget_wrapper'] != false ) {
?>
</div>
</div> <!-- Closing <div id='course_navigation'> -->
<?php
/** This filter is documented in themes/ld30/templates/course.php */
if ( apply_filters( 'learndash_course_steps_expand_all', false, $course_id, 'course_navigation_widget' ) ) {
?>
<script>
jQuery( function() {
setTimeout(function(){
jQuery(".course_navigation .list_arrow").trigger('click');
}, 1000);
});
</script>
<?php
}
}