@@ -10,8 +10,8 @@ |
||
| 10 | 10 | * @author WooThemes |
| 11 | 11 | * @since 1.0.0 |
| 12 | 12 | */ |
| 13 | -if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); |
|
| 13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) exit(); |
|
| 14 | 14 | |
| 15 | 15 | $token = 'woothemes-sensei'; |
| 16 | -delete_option( 'skip_install_sensei_pages' ); |
|
| 17 | -delete_option( 'sensei_installed' ); |
|
| 18 | 16 | \ No newline at end of file |
| 17 | +delete_option('skip_install_sensei_pages'); |
|
| 18 | +delete_option('sensei_installed'); |
|
| 19 | 19 | \ No newline at end of file |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * WooThemes Sensei Uninstall |
|
| 4 | - * |
|
| 5 | - * Uninstalls the plugin and associated data. |
|
| 6 | - * |
|
| 7 | - * @package WordPress |
|
| 8 | - * @subpackage Sensei |
|
| 9 | - * @category Core |
|
| 10 | - * @author WooThemes |
|
| 11 | - * @since 1.0.0 |
|
| 12 | - */ |
|
| 3 | + * WooThemes Sensei Uninstall |
|
| 4 | + * |
|
| 5 | + * Uninstalls the plugin and associated data. |
|
| 6 | + * |
|
| 7 | + * @package WordPress |
|
| 8 | + * @subpackage Sensei |
|
| 9 | + * @category Core |
|
| 10 | + * @author WooThemes |
|
| 11 | + * @since 1.0.0 |
|
| 12 | + */ |
|
| 13 | 13 | if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); |
| 14 | 14 | |
| 15 | 15 | $token = 'woothemes-sensei'; |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
| 65 | 65 | |
| 66 | 66 | if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) |
| 67 | - && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) |
|
| 68 | - && !is_user_logged_in() ) {
|
|
| 67 | + && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) |
|
| 68 | + && !is_user_logged_in() ) {
|
|
| 69 | 69 | |
| 70 | 70 | // No Output |
| 71 | - return; |
|
| 71 | + return; |
|
| 72 | 72 | |
| 73 | 73 | } else {
|
| 74 | 74 | /* Our variables from the widget settings. */ |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param array $instance The settings for this instance. |
| 131 | 131 | * @return void |
| 132 | 132 | */ |
| 133 | - public function form( $instance ) {
|
|
| 133 | + public function form( $instance ) {
|
|
| 134 | 134 | |
| 135 | 135 | /* Set up some default widget settings. */ |
| 136 | 136 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * Load the desired component, if a method is available for it. |
| 170 | 170 | * @param string $component The component to potentially be loaded. |
| 171 | - * |
|
| 171 | + * |
|
| 172 | 172 | * @since 1.0.0 |
| 173 | 173 | * @return void |
| 174 | 174 | */ |
@@ -207,24 +207,24 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( ! empty( $course_ids ) ) {
|
|
| 210 | + if ( ! empty( $course_ids ) ) {
|
|
| 211 | 211 | |
| 212 | - $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids ); |
|
| 212 | + $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids ); |
|
| 213 | 213 | |
| 214 | 214 | } else {
|
| 215 | 215 | |
| 216 | - if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 216 | + if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 217 | 217 | $posts_array = array(); |
| 218 | 218 | |
| 219 | - } else {
|
|
| 219 | + } else {
|
|
| 220 | 220 | |
| 221 | - $course_args = array( |
|
| 222 | - 'post_type' => 'course', |
|
| 223 | - 'orderby' => 'date', |
|
| 224 | - 'order' => 'DESC', |
|
| 225 | - 'post_status' => 'publish', |
|
| 226 | - 'posts_per_page' => $instance['limit'], |
|
| 227 | - ); |
|
| 221 | + $course_args = array( |
|
| 222 | + 'post_type' => 'course', |
|
| 223 | + 'orderby' => 'date', |
|
| 224 | + 'order' => 'DESC', |
|
| 225 | + 'post_status' => 'publish', |
|
| 226 | + 'posts_per_page' => $instance['limit'], |
|
| 227 | + ); |
|
| 228 | 228 | |
| 229 | 229 | $posts_array = get_posts( $course_args ); |
| 230 | 230 | } |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | if ( count( $posts_array ) > 0 ) { ?>
|
| 235 | 235 | <ul> |
| 236 | 236 | <?php foreach ($posts_array as $post_item){
|
| 237 | - $post_id = absint( $post_item->ID ); |
|
| 238 | - $post_title = $post_item->post_title; |
|
| 239 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 240 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 241 | - $author_display_name = $user_info->display_name; |
|
| 242 | - $author_id = $post_item->post_author; |
|
| 243 | - ?> |
|
| 237 | + $post_id = absint( $post_item->ID ); |
|
| 238 | + $post_title = $post_item->post_title; |
|
| 239 | + $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 240 | + $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 241 | + $author_display_name = $user_info->display_name; |
|
| 242 | + $author_id = $post_item->post_author; |
|
| 243 | + ?> |
|
| 244 | 244 | <li class="fix"> |
| 245 | 245 | <?php do_action( 'sensei_course_image', $post_id ); ?> |
| 246 | 246 | <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | </li> |
| 256 | 256 | <?php } // End For Loop ?> |
| 257 | 257 | <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
| 258 | - $my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] ); |
|
| 259 | - echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 260 | - } // End If Statement ?> |
|
| 258 | + $my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] ); |
|
| 259 | + echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 260 | + } // End If Statement ?> |
|
| 261 | 261 | </ul> |
| 262 | 262 | <?php } else {
|
| 263 | 263 | // No posts returned. This means the user either has no active or no completed courses. |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
|
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Sensei Course Component Widget |
@@ -26,30 +26,30 @@ discard block |
||
| 26 | 26 | public function __construct() {
|
| 27 | 27 | /* Widget variable settings. */ |
| 28 | 28 | $this->woo_widget_cssclass = 'widget_sensei_course_component'; |
| 29 | - $this->woo_widget_description = __( 'This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei' ); |
|
| 29 | + $this->woo_widget_description = __('This widget will output a list of Courses - New, Featured, Free, Paid, Active, Completed.', 'woothemes-sensei');
|
|
| 30 | 30 | $this->woo_widget_idbase = 'sensei_course_component'; |
| 31 | - $this->woo_widget_title = __( 'Sensei - Course Component', 'woothemes-sensei' ); |
|
| 31 | + $this->woo_widget_title = __('Sensei - Course Component', 'woothemes-sensei');
|
|
| 32 | 32 | |
| 33 | 33 | $this->woo_widget_componentslist = array( |
| 34 | - 'usercourses' => __( 'New Courses', 'woothemes-sensei' ), |
|
| 35 | - 'featuredcourses' => __( 'Featured Courses', 'woothemes-sensei' ), |
|
| 36 | - 'activecourses' => __( 'My Active Courses', 'woothemes-sensei' ), |
|
| 37 | - 'completedcourses' => __( 'My Completed Courses', 'woothemes-sensei' ), |
|
| 34 | + 'usercourses' => __('New Courses', 'woothemes-sensei'),
|
|
| 35 | + 'featuredcourses' => __('Featured Courses', 'woothemes-sensei'),
|
|
| 36 | + 'activecourses' => __('My Active Courses', 'woothemes-sensei'),
|
|
| 37 | + 'completedcourses' => __('My Completed Courses', 'woothemes-sensei'),
|
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | // Add support for the WooCommerce shelf. |
| 41 | - if ( Sensei_WC::is_woocommerce_active() ) {
|
|
| 42 | - $this->woo_widget_componentslist['freecourses'] = __( 'Free Courses', 'woothemes-sensei' ); |
|
| 43 | - $this->woo_widget_componentslist['paidcourses'] = __( 'Paid Courses', 'woothemes-sensei' ); |
|
| 41 | + if (Sensei_WC::is_woocommerce_active()) {
|
|
| 42 | + $this->woo_widget_componentslist['freecourses'] = __('Free Courses', 'woothemes-sensei');
|
|
| 43 | + $this->woo_widget_componentslist['paidcourses'] = __('Paid Courses', 'woothemes-sensei');
|
|
| 44 | 44 | } |
| 45 | 45 | /* Widget settings. */ |
| 46 | - $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description ); |
|
| 46 | + $widget_ops = array('classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description);
|
|
| 47 | 47 | |
| 48 | 48 | /* Widget control settings. */ |
| 49 | - $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase ); |
|
| 49 | + $control_ops = array('width' => 250, 'height' => 350, 'id_base' => $this->woo_widget_idbase);
|
|
| 50 | 50 | |
| 51 | 51 | /* Create the widget. */ |
| 52 | - parent::__construct( $this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops ); |
|
| 52 | + parent::__construct($this->woo_widget_idbase, $this->woo_widget_title, $widget_ops, $control_ops); |
|
| 53 | 53 | } // End __construct() |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -59,44 +59,44 @@ discard block |
||
| 59 | 59 | * @param array $instance Widget settings for this instance. |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | - public function widget( $args, $instance ) {
|
|
| 62 | + public function widget($args, $instance) {
|
|
| 63 | 63 | |
| 64 | - remove_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
|
| 64 | + remove_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
|
|
| 65 | 65 | |
| 66 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) |
|
| 67 | - && ( 'activecourses' == $instance['component'] || 'completedcourses' == $instance['component'] ) |
|
| 68 | - && !is_user_logged_in() ) {
|
|
| 66 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist)) |
|
| 67 | + && ('activecourses' == $instance['component'] || 'completedcourses' == $instance['component'])
|
|
| 68 | + && ! is_user_logged_in()) {
|
|
| 69 | 69 | |
| 70 | 70 | // No Output |
| 71 | 71 | return; |
| 72 | 72 | |
| 73 | 73 | } else {
|
| 74 | 74 | /* Our variables from the widget settings. */ |
| 75 | - $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
|
| 75 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
| 76 | 76 | |
| 77 | 77 | /* Before widget (defined by themes). */ |
| 78 | 78 | echo $args['before_widget']; |
| 79 | 79 | |
| 80 | 80 | /* Display the widget title if one was input (before and after defined by themes). */ |
| 81 | - if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }
|
|
| 81 | + if ($title) { echo $args['before_title'].$title.$args['after_title']; }
|
|
| 82 | 82 | |
| 83 | 83 | /* Widget content. */ |
| 84 | 84 | // Add actions for plugins/themes to hook onto. |
| 85 | - do_action( $this->woo_widget_cssclass . '_top' ); |
|
| 85 | + do_action($this->woo_widget_cssclass.'_top'); |
|
| 86 | 86 | |
| 87 | - if ( in_array( $instance['component'], array_keys( $this->woo_widget_componentslist ) ) ) {
|
|
| 88 | - $this->load_component( $instance ); |
|
| 87 | + if (in_array($instance['component'], array_keys($this->woo_widget_componentslist))) {
|
|
| 88 | + $this->load_component($instance); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Add actions for plugins/themes to hook onto. |
| 92 | - do_action( $this->woo_widget_cssclass . '_bottom' ); |
|
| 92 | + do_action($this->woo_widget_cssclass.'_bottom'); |
|
| 93 | 93 | |
| 94 | 94 | /* After widget (defined by themes). */ |
| 95 | 95 | echo $args['after_widget']; |
| 96 | 96 | |
| 97 | 97 | } // End If Statement |
| 98 | 98 | |
| 99 | - add_filter( 'pre_get_posts', 'sensei_course_archive_filter', 10, 1 ); |
|
| 99 | + add_filter('pre_get_posts', 'sensei_course_archive_filter', 10, 1);
|
|
| 100 | 100 | |
| 101 | 101 | } // End widget() |
| 102 | 102 | |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * @param array $old_instance Previous settings. |
| 108 | 108 | * @return array Updated settings. |
| 109 | 109 | */ |
| 110 | - public function update ( $new_instance, $old_instance ) {
|
|
| 110 | + public function update($new_instance, $old_instance) {
|
|
| 111 | 111 | $instance = $old_instance; |
| 112 | 112 | |
| 113 | 113 | /* Strip tags for title and name to remove HTML (important for text inputs). */ |
| 114 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 114 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 115 | 115 | |
| 116 | 116 | /* The select box is returning a text value, so we escape it. */ |
| 117 | - $instance['component'] = esc_attr( $new_instance['component'] ); |
|
| 117 | + $instance['component'] = esc_attr($new_instance['component']); |
|
| 118 | 118 | |
| 119 | 119 | /* The select box is returning a text value, so we escape it. */ |
| 120 | - $instance['limit'] = esc_attr( $new_instance['limit'] ); |
|
| 120 | + $instance['limit'] = esc_attr($new_instance['limit']); |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | return $instance; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param array $instance The settings for this instance. |
| 131 | 131 | * @return void |
| 132 | 132 | */ |
| 133 | - public function form( $instance ) {
|
|
| 133 | + public function form($instance) {
|
|
| 134 | 134 | |
| 135 | 135 | /* Set up some default widget settings. */ |
| 136 | 136 | /* Make sure all keys are added here, even with empty string values. */ |
@@ -140,26 +140,26 @@ discard block |
||
| 140 | 140 | 'limit' => 3 |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 143 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 144 | 144 | ?> |
| 145 | 145 | <!-- Widget Title: Text Input --> |
| 146 | 146 | <p> |
| 147 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title (optional):', 'woothemes-sensei' ); ?></label> |
|
| 148 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" /> |
|
| 147 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title (optional):', 'woothemes-sensei'); ?></label>
|
|
| 148 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" />
|
|
| 149 | 149 | </p> |
| 150 | 150 | <!-- Widget Component: Select Input --> |
| 151 | 151 | <p> |
| 152 | - <label for="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"><?php _e( 'Component:', 'woothemes-sensei' ); ?></label> |
|
| 153 | - <select name="<?php echo esc_attr( $this->get_field_name( 'component' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'component' ) ); ?>"> |
|
| 154 | - <?php foreach ( $this->woo_widget_componentslist as $k => $v ) { ?>
|
|
| 155 | - <option value="<?php echo esc_attr( $k ); ?>"<?php selected( $instance['component'], $k ); ?>><?php echo $v; ?></option> |
|
| 152 | + <label for="<?php echo esc_attr($this->get_field_id('component')); ?>"><?php _e('Component:', 'woothemes-sensei'); ?></label>
|
|
| 153 | + <select name="<?php echo esc_attr($this->get_field_name('component')); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('component')); ?>">
|
|
| 154 | + <?php foreach ($this->woo_widget_componentslist as $k => $v) { ?>
|
|
| 155 | + <option value="<?php echo esc_attr($k); ?>"<?php selected($instance['component'], $k); ?>><?php echo $v; ?></option> |
|
| 156 | 156 | <?php } ?> |
| 157 | 157 | </select> |
| 158 | 158 | </p> |
| 159 | 159 | <!-- Widget Limit: Text Input --> |
| 160 | 160 | <p> |
| 161 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Number of Courses (optional):', 'woothemes-sensei' ); ?></label> |
|
| 162 | - <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" /> |
|
| 161 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Number of Courses (optional):', 'woothemes-sensei'); ?></label>
|
|
| 162 | + <input type="text" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" value="<?php echo esc_attr($instance['limit']); ?>" class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" />
|
|
| 163 | 163 | </p> |
| 164 | 164 | |
| 165 | 165 | <?php |
@@ -172,28 +172,28 @@ discard block |
||
| 172 | 172 | * @since 1.0.0 |
| 173 | 173 | * @return void |
| 174 | 174 | */ |
| 175 | - protected function load_component ( $instance ) {
|
|
| 175 | + protected function load_component($instance) {
|
|
| 176 | 176 | global $current_user; |
| 177 | 177 | |
| 178 | 178 | get_currentuserinfo(); |
| 179 | 179 | |
| 180 | 180 | $course_ids = array(); |
| 181 | - if ( 'activecourses' == esc_attr( $instance['component'] ) ) {
|
|
| 182 | - $courses = Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress' ), true ); |
|
| 181 | + if ('activecourses' == esc_attr($instance['component'])) {
|
|
| 182 | + $courses = Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress'), true);
|
|
| 183 | 183 | // Need to always return an array, even with only 1 item |
| 184 | - if ( !is_array($courses) ) {
|
|
| 185 | - $courses = array( $courses ); |
|
| 184 | + if ( ! is_array($courses)) {
|
|
| 185 | + $courses = array($courses); |
|
| 186 | 186 | } |
| 187 | - foreach( $courses AS $course ) {
|
|
| 187 | + foreach ($courses AS $course) {
|
|
| 188 | 188 | $course_ids[] = $course->comment_post_ID; |
| 189 | 189 | } |
| 190 | - } elseif( 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 191 | - $courses = Sensei_Utils::sensei_check_for_activity( array( 'user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete' ), true ); |
|
| 190 | + } elseif ('completedcourses' == esc_attr($instance['component'])) {
|
|
| 191 | + $courses = Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete'), true);
|
|
| 192 | 192 | // Need to always return an array, even with only 1 item |
| 193 | - if ( !is_array($courses) ) {
|
|
| 194 | - $courses = array( $courses ); |
|
| 193 | + if ( ! is_array($courses)) {
|
|
| 194 | + $courses = array($courses); |
|
| 195 | 195 | } |
| 196 | - foreach( $courses AS $course ) {
|
|
| 196 | + foreach ($courses AS $course) {
|
|
| 197 | 197 | $course_ids[] = $course->comment_post_ID; |
| 198 | 198 | } |
| 199 | 199 | } // End If Statement |
@@ -201,19 +201,19 @@ discard block |
||
| 201 | 201 | $posts_array = array(); |
| 202 | 202 | |
| 203 | 203 | // course_query() is buggy, it doesn't honour the 1st arg if includes are provided, so instead slice the includes |
| 204 | - if ( !empty($instance['limit']) && intval( $instance['limit'] ) >= 1 && intval( $instance['limit'] ) < count($course_ids) ) {
|
|
| 204 | + if ( ! empty($instance['limit']) && intval($instance['limit']) >= 1 && intval($instance['limit']) < count($course_ids)) {
|
|
| 205 | 205 | |
| 206 | - $course_ids = array_slice( $course_ids, 0, intval( $instance['limit'] ) ); // This does mean the order by is effectively ignored |
|
| 206 | + $course_ids = array_slice($course_ids, 0, intval($instance['limit'])); // This does mean the order by is effectively ignored |
|
| 207 | 207 | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( ! empty( $course_ids ) ) {
|
|
| 210 | + if ( ! empty($course_ids)) {
|
|
| 211 | 211 | |
| 212 | - $posts_array = Sensei()->course->course_query( intval( $instance['limit'] ), esc_attr( $instance['component'] ), $course_ids ); |
|
| 212 | + $posts_array = Sensei()->course->course_query(intval($instance['limit']), esc_attr($instance['component']), $course_ids); |
|
| 213 | 213 | |
| 214 | 214 | } else {
|
| 215 | 215 | |
| 216 | - if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 216 | + if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
|
|
| 217 | 217 | $posts_array = array(); |
| 218 | 218 | |
| 219 | 219 | } else {
|
@@ -226,43 +226,43 @@ discard block |
||
| 226 | 226 | 'posts_per_page' => $instance['limit'], |
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | - $posts_array = get_posts( $course_args ); |
|
| 229 | + $posts_array = get_posts($course_args); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | } // End If Statement |
| 233 | 233 | |
| 234 | - if ( count( $posts_array ) > 0 ) { ?>
|
|
| 234 | + if (count($posts_array) > 0) { ?>
|
|
| 235 | 235 | <ul> |
| 236 | - <?php foreach ($posts_array as $post_item){
|
|
| 237 | - $post_id = absint( $post_item->ID ); |
|
| 236 | + <?php foreach ($posts_array as $post_item) {
|
|
| 237 | + $post_id = absint($post_item->ID); |
|
| 238 | 238 | $post_title = $post_item->post_title; |
| 239 | - $user_info = get_userdata( absint( $post_item->post_author ) ); |
|
| 240 | - $author_link = get_author_posts_url( absint( $post_item->post_author ) ); |
|
| 239 | + $user_info = get_userdata(absint($post_item->post_author)); |
|
| 240 | + $author_link = get_author_posts_url(absint($post_item->post_author)); |
|
| 241 | 241 | $author_display_name = $user_info->display_name; |
| 242 | 242 | $author_id = $post_item->post_author; |
| 243 | 243 | ?> |
| 244 | 244 | <li class="fix"> |
| 245 | - <?php do_action( 'sensei_course_image', $post_id ); ?> |
|
| 246 | - <a href="<?php echo esc_url( get_permalink( $post_id ) ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a> |
|
| 245 | + <?php do_action('sensei_course_image', $post_id); ?>
|
|
| 246 | + <a href="<?php echo esc_url(get_permalink($post_id)); ?>" title="<?php echo esc_attr($post_title); ?>"><?php echo $post_title; ?></a> |
|
| 247 | 247 | <br /> |
| 248 | - <?php if ( isset( Sensei()->settings->settings[ 'course_author' ] ) && ( Sensei()->settings->settings[ 'course_author' ] ) ) { ?>
|
|
| 249 | - <span class="course-author"><?php _e( 'by ', 'woothemes-sensei' ); ?><a href="<?php echo esc_url( $author_link ); ?>" title="<?php echo esc_attr( $author_display_name ); ?>"><?php echo esc_html( $author_display_name ); ?></a></span> |
|
| 248 | + <?php if (isset(Sensei()->settings->settings['course_author']) && (Sensei()->settings->settings['course_author'])) { ?>
|
|
| 249 | + <span class="course-author"><?php _e('by ', 'woothemes-sensei'); ?><a href="<?php echo esc_url($author_link); ?>" title="<?php echo esc_attr($author_display_name); ?>"><?php echo esc_html($author_display_name); ?></a></span>
|
|
| 250 | 250 | <br /> |
| 251 | 251 | <?php } // End If Statement ?> |
| 252 | - <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count( $post_id ) . ' ' . __( 'Lessons', 'woothemes-sensei' ); ?></span> |
|
| 252 | + <span class="course-lesson-count"><?php echo Sensei()->course->course_lesson_count($post_id).' '.__('Lessons', 'woothemes-sensei'); ?></span>
|
|
| 253 | 253 | <br /> |
| 254 | - <?php sensei_simple_course_price( $post_id ); ?> |
|
| 254 | + <?php sensei_simple_course_price($post_id); ?> |
|
| 255 | 255 | </li> |
| 256 | 256 | <?php } // End For Loop ?> |
| 257 | - <?php if ( 'activecourses' == esc_attr( $instance['component'] ) || 'completedcourses' == esc_attr( $instance['component'] ) ) {
|
|
| 258 | - $my_account_page_id = intval( Sensei()->settings->settings[ 'my_course_page' ] ); |
|
| 259 | - echo '<li class="my-account fix"><a href="'. esc_url( get_permalink( $my_account_page_id ) ) .'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 257 | + <?php if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
|
|
| 258 | + $my_account_page_id = intval(Sensei()->settings->settings['my_course_page']); |
|
| 259 | + echo '<li class="my-account fix"><a href="'.esc_url(get_permalink($my_account_page_id)).'">'.__('My Courses', 'woothemes-sensei').' <span class="meta-nav"></span></a></li>';
|
|
| 260 | 260 | } // End If Statement ?> |
| 261 | 261 | </ul> |
| 262 | 262 | <?php } else {
|
| 263 | 263 | // No posts returned. This means the user either has no active or no completed courses. |
| 264 | - $course_status = substr( esc_attr( $instance['component'] ) , 0, -7); |
|
| 265 | - echo sprintf( __( 'You have no %1s courses.', 'woothemes-sensei' ), $course_status ); |
|
| 264 | + $course_status = substr(esc_attr($instance['component']), 0, -7); |
|
| 265 | + echo sprintf(__('You have no %1s courses.', 'woothemes-sensei'), $course_status);
|
|
| 266 | 266 | } // End If Statement |
| 267 | 267 | } // End load_component() |
| 268 | 268 | } // End Class |
| 269 | 269 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * Content-lesson.php template file |
| 5 | 5 | * |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | -<article <?php post_class( get_the_ID() ); ?> > |
|
| 17 | +<article <?php post_class(get_the_ID()); ?> > |
|
| 18 | 18 | |
| 19 | 19 | <section class="lesson-content"> |
| 20 | 20 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @since 1.9.0 |
| 28 | 28 | * @param string $post_id |
| 29 | 29 | */ |
| 30 | - do_action( 'sensei_content_lesson_before', get_the_ID() ); |
|
| 30 | + do_action('sensei_content_lesson_before', get_the_ID()); |
|
| 31 | 31 | ?> |
| 32 | 32 | |
| 33 | 33 | <section class="entry"> |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * @since 1.9.0 |
| 74 | 74 | * @param string $post_id |
| 75 | 75 | */ |
| 76 | - do_action( 'sensei_content_lesson_after', get_the_ID() ); |
|
| 76 | + do_action('sensei_content_lesson_after', get_the_ID()); |
|
| 77 | 77 | ?> |
| 78 | 78 | |
| 79 | 79 | </section> <!-- article .lesson-content --> |
| 80 | 80 | |
| 81 | -</article> <!-- article .(<?php esc_attr_e( join( ' ', get_post_class( array( 'lesson', 'post' ) ) ) ); ?> --> |
|
| 82 | 81 | \ No newline at end of file |
| 82 | +</article> <!-- article .(<?php esc_attr_e(join(' ', get_post_class(array('lesson', 'post')))); ?> --> |
|
| 83 | 83 | \ No newline at end of file |
@@ -1,17 +1,17 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | 3 | /** |
| 4 | - * Content-lesson.php template file |
|
| 5 | - * |
|
| 6 | - * responsible for content on archive like pages. Only shows the lesson excerpt. |
|
| 7 | - * |
|
| 8 | - * For single lesson content please see single-lesson.php |
|
| 9 | - * |
|
| 10 | - * @author Automattic |
|
| 11 | - * @package Sensei |
|
| 12 | - * @category Templates |
|
| 13 | - * @version 1.9.0 |
|
| 14 | - */ |
|
| 4 | + * Content-lesson.php template file |
|
| 5 | + * |
|
| 6 | + * responsible for content on archive like pages. Only shows the lesson excerpt. |
|
| 7 | + * |
|
| 8 | + * For single lesson content please see single-lesson.php |
|
| 9 | + * |
|
| 10 | + * @author Automattic |
|
| 11 | + * @package Sensei |
|
| 12 | + * @category Templates |
|
| 13 | + * @version 1.9.0 |
|
| 14 | + */ |
|
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | 17 | <article <?php post_class( get_the_ID() ); ?> > |
@@ -19,32 +19,32 @@ discard block |
||
| 19 | 19 | <section class="lesson-content"> |
| 20 | 20 | |
| 21 | 21 | <?php |
| 22 | - /** |
|
| 23 | - * sensei_content_lesson_before |
|
| 24 | - * action that runs before the sensei {post_type} content. It runs inside the sensei |
|
| 25 | - * content.php template. This applies to the specific post type that you've targeted. |
|
| 26 | - * |
|
| 27 | - * @since 1.9.0 |
|
| 28 | - * @param string $lesson_id |
|
| 29 | - */ |
|
| 30 | - do_action( 'sensei_content_lesson_before', get_the_ID() ); |
|
| 31 | - ?> |
|
| 22 | + /** |
|
| 23 | + * sensei_content_lesson_before |
|
| 24 | + * action that runs before the sensei {post_type} content. It runs inside the sensei |
|
| 25 | + * content.php template. This applies to the specific post type that you've targeted. |
|
| 26 | + * |
|
| 27 | + * @since 1.9.0 |
|
| 28 | + * @param string $lesson_id |
|
| 29 | + */ |
|
| 30 | + do_action( 'sensei_content_lesson_before', get_the_ID() ); |
|
| 31 | + ?> |
|
| 32 | 32 | |
| 33 | 33 | <section class="entry"> |
| 34 | 34 | |
| 35 | 35 | <?php |
| 36 | - /** |
|
| 37 | - * Fires just before the post content in the content-lesson.php file. |
|
| 38 | - * |
|
| 39 | - * @since 1.9.0 |
|
| 40 | - * |
|
| 41 | - * @hooked Sensei()->modules->module_archive_description - 11 |
|
| 42 | - * @hooked Sensei_Lesson::the_lesson_meta - 20 |
|
| 43 | - * |
|
| 44 | - * @param string $lesson_id |
|
| 45 | - */ |
|
| 46 | - do_action('sensei_content_lesson_inside_before', get_the_ID()); |
|
| 47 | - ?> |
|
| 36 | + /** |
|
| 37 | + * Fires just before the post content in the content-lesson.php file. |
|
| 38 | + * |
|
| 39 | + * @since 1.9.0 |
|
| 40 | + * |
|
| 41 | + * @hooked Sensei()->modules->module_archive_description - 11 |
|
| 42 | + * @hooked Sensei_Lesson::the_lesson_meta - 20 |
|
| 43 | + * |
|
| 44 | + * @param string $lesson_id |
|
| 45 | + */ |
|
| 46 | + do_action('sensei_content_lesson_inside_before', get_the_ID()); |
|
| 47 | + ?> |
|
| 48 | 48 | |
| 49 | 49 | <p class="lesson-excerpt"> |
| 50 | 50 | |
@@ -53,28 +53,28 @@ discard block |
||
| 53 | 53 | </p> |
| 54 | 54 | |
| 55 | 55 | <?php |
| 56 | - /** |
|
| 57 | - * Fires just after the post content in the lesson-content.php file. |
|
| 58 | - * |
|
| 59 | - * @since 1.9.0 |
|
| 60 | - * |
|
| 61 | - * @param string $lesson_id |
|
| 62 | - */ |
|
| 63 | - do_action('sensei_content_lesson_inside_after', get_the_ID()); |
|
| 64 | - ?> |
|
| 56 | + /** |
|
| 57 | + * Fires just after the post content in the lesson-content.php file. |
|
| 58 | + * |
|
| 59 | + * @since 1.9.0 |
|
| 60 | + * |
|
| 61 | + * @param string $lesson_id |
|
| 62 | + */ |
|
| 63 | + do_action('sensei_content_lesson_inside_after', get_the_ID()); |
|
| 64 | + ?> |
|
| 65 | 65 | |
| 66 | 66 | </section> <!-- section .entry --> |
| 67 | 67 | |
| 68 | 68 | <?php |
| 69 | - /** |
|
| 70 | - * This action runs after the sensei lesson content. It runs inside the sensei |
|
| 71 | - * lesson-content.php template. |
|
| 72 | - * |
|
| 73 | - * @since 1.9.0 |
|
| 74 | - * @param string $lesson_id |
|
| 75 | - */ |
|
| 76 | - do_action( 'sensei_content_lesson_after', get_the_ID() ); |
|
| 77 | - ?> |
|
| 69 | + /** |
|
| 70 | + * This action runs after the sensei lesson content. It runs inside the sensei |
|
| 71 | + * lesson-content.php template. |
|
| 72 | + * |
|
| 73 | + * @since 1.9.0 |
|
| 74 | + * @param string $lesson_id |
|
| 75 | + */ |
|
| 76 | + do_action( 'sensei_content_lesson_after', get_the_ID() ); |
|
| 77 | + ?> |
|
| 78 | 78 | |
| 79 | 79 | </section> <!-- article .lesson-content --> |
| 80 | 80 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | -<?php get_sensei_header(); ?> |
|
| 15 | +<?php get_sensei_header(); ?> |
|
| 16 | 16 | |
| 17 | 17 | <?php |
| 18 | 18 | |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | * @since 1.9.0 |
| 24 | 24 | * |
| 25 | 25 | */ |
| 26 | - do_action( 'sensei_teacher_archive_course_loop_before' ); |
|
| 26 | + do_action('sensei_teacher_archive_course_loop_before'); |
|
| 27 | 27 | |
| 28 | 28 | ?> |
| 29 | 29 | |
| 30 | - <?php if ( have_posts() ): ?> |
|
| 30 | + <?php if (have_posts()): ?> |
|
| 31 | 31 | |
| 32 | - <?php sensei_load_template( 'loop-course.php' ); ?> |
|
| 32 | + <?php sensei_load_template('loop-course.php'); ?> |
|
| 33 | 33 | |
| 34 | 34 | <?php else: ?> |
| 35 | 35 | |
| 36 | - <p><?php _e( 'There are no courses for this teacher.', 'woothemes-sensei' ); ?></p> |
|
| 36 | + <p><?php _e('There are no courses for this teacher.', 'woothemes-sensei'); ?></p> |
|
| 37 | 37 | |
| 38 | 38 | <?php endif; // End If Statement ?> |
| 39 | 39 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @since 1.9.0 |
| 47 | 47 | */ |
| 48 | - do_action( 'sensei_teacher_archive_course_loop_after' ); |
|
| 48 | + do_action('sensei_teacher_archive_course_loop_after'); |
|
| 49 | 49 | |
| 50 | 50 | ?> |
| 51 | 51 | |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | <?php |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * This action before teacher courses loop. This hook fires within the archive-course.php |
|
| 21 | - * It fires even if the current archive has no posts. |
|
| 22 | - * |
|
| 23 | - * @since 1.9.0 |
|
| 24 | - * |
|
| 25 | - */ |
|
| 26 | - do_action( 'sensei_teacher_archive_course_loop_before' ); |
|
| 19 | + /** |
|
| 20 | + * This action before teacher courses loop. This hook fires within the archive-course.php |
|
| 21 | + * It fires even if the current archive has no posts. |
|
| 22 | + * |
|
| 23 | + * @since 1.9.0 |
|
| 24 | + * |
|
| 25 | + */ |
|
| 26 | + do_action( 'sensei_teacher_archive_course_loop_before' ); |
|
| 27 | 27 | |
| 28 | - ?> |
|
| 28 | + ?> |
|
| 29 | 29 | |
| 30 | 30 | <?php if ( have_posts() ): ?> |
| 31 | 31 | |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * This action runs after including the teacher archive loop. This hook fires within the teacher-archive.php |
|
| 44 | - * It fires even if the current archive has no posts. |
|
| 45 | - * |
|
| 46 | - * @since 1.9.0 |
|
| 47 | - */ |
|
| 48 | - do_action( 'sensei_teacher_archive_course_loop_after' ); |
|
| 42 | + /** |
|
| 43 | + * This action runs after including the teacher archive loop. This hook fires within the teacher-archive.php |
|
| 44 | + * It fires even if the current archive has no posts. |
|
| 45 | + * |
|
| 46 | + * @since 1.9.0 |
|
| 47 | + */ |
|
| 48 | + do_action( 'sensei_teacher_archive_course_loop_after' ); |
|
| 49 | 49 | |
| 50 | - ?> |
|
| 50 | + ?> |
|
| 51 | 51 | |
| 52 | 52 | <?php get_sensei_footer(); ?> |
@@ -1,29 +1,29 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The Template for displaying lesson archives, including the lesson page template. |
|
| 4 | - * This template also handels the lesson modules taxonomy and the lessons_tag taxonomy. |
|
| 5 | - * |
|
| 6 | - * Override this template by copying it to your_theme/sensei/archive-lesson.php |
|
| 7 | - * |
|
| 8 | - * @author Automattic |
|
| 9 | - * @package Sensei |
|
| 10 | - * @category Templates |
|
| 11 | - * @version 1.9.0 |
|
| 12 | - */ |
|
| 3 | + * The Template for displaying lesson archives, including the lesson page template. |
|
| 4 | + * This template also handels the lesson modules taxonomy and the lessons_tag taxonomy. |
|
| 5 | + * |
|
| 6 | + * Override this template by copying it to your_theme/sensei/archive-lesson.php |
|
| 7 | + * |
|
| 8 | + * @author Automattic |
|
| 9 | + * @package Sensei |
|
| 10 | + * @category Templates |
|
| 11 | + * @version 1.9.0 |
|
| 12 | + */ |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <?php get_sensei_header(); ?> |
| 16 | 16 | |
| 17 | 17 | <?php |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Action before lesson archive loop. This action runs within the archive-lesson.php. |
|
| 21 | - * |
|
| 22 | - * It will be executed even if there are no posts on the archive page. |
|
| 23 | - */ |
|
| 24 | - do_action( 'sensei_archive_before_lesson_loop' ); |
|
| 19 | + /** |
|
| 20 | + * Action before lesson archive loop. This action runs within the archive-lesson.php. |
|
| 21 | + * |
|
| 22 | + * It will be executed even if there are no posts on the archive page. |
|
| 23 | + */ |
|
| 24 | + do_action( 'sensei_archive_before_lesson_loop' ); |
|
| 25 | 25 | |
| 26 | - ?> |
|
| 26 | + ?> |
|
| 27 | 27 | |
| 28 | 28 | <?php if ( have_posts() ): ?> |
| 29 | 29 | |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Action after lesson archive loop on the archive-lesson.php template file |
|
| 42 | - * It will be executed even if there are no posts on the archive page. |
|
| 43 | - * |
|
| 44 | - * @since 1.9.0 |
|
| 45 | - */ |
|
| 46 | - do_action( 'sensei_archive_after_lesson_loop' ); |
|
| 47 | - ?> |
|
| 40 | + /** |
|
| 41 | + * Action after lesson archive loop on the archive-lesson.php template file |
|
| 42 | + * It will be executed even if there are no posts on the archive page. |
|
| 43 | + * |
|
| 44 | + * @since 1.9.0 |
|
| 45 | + */ |
|
| 46 | + do_action( 'sensei_archive_after_lesson_loop' ); |
|
| 47 | + ?> |
|
| 48 | 48 | <?php get_sensei_footer(); ?> |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | -<?php get_sensei_header(); ?> |
|
| 15 | +<?php get_sensei_header(); ?> |
|
| 16 | 16 | |
| 17 | 17 | <?php |
| 18 | 18 | |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * It will be executed even if there are no posts on the archive page. |
| 23 | 23 | */ |
| 24 | - do_action( 'sensei_archive_before_lesson_loop' ); |
|
| 24 | + do_action('sensei_archive_before_lesson_loop'); |
|
| 25 | 25 | |
| 26 | 26 | ?> |
| 27 | 27 | |
| 28 | - <?php if ( have_posts() ): ?> |
|
| 28 | + <?php if (have_posts()): ?> |
|
| 29 | 29 | |
| 30 | - <?php sensei_load_template( 'loop-lesson.php' ); ?> |
|
| 30 | + <?php sensei_load_template('loop-lesson.php'); ?> |
|
| 31 | 31 | |
| 32 | 32 | <?php else: ?> |
| 33 | 33 | |
| 34 | - <p><?php _e( 'No lessons found that match your selection.', 'woothemes-sensei' ); ?></p> |
|
| 34 | + <p><?php _e('No lessons found that match your selection.', 'woothemes-sensei'); ?></p> |
|
| 35 | 35 | |
| 36 | 36 | <?php endif; // End If Statement ?> |
| 37 | 37 | |
@@ -43,6 +43,6 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @since 1.9.0 |
| 45 | 45 | */ |
| 46 | - do_action( 'sensei_archive_after_lesson_loop' ); |
|
| 46 | + do_action('sensei_archive_after_lesson_loop'); |
|
| 47 | 47 | ?> |
| 48 | 48 | <?php get_sensei_footer(); ?> |
@@ -1,65 +1,65 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | 3 | /** |
| 4 | - * The Template for outputting Lesson Archive items |
|
| 5 | - * |
|
| 6 | - * Override this template by copying it to yourtheme/sensei/loop-lesson.php |
|
| 7 | - * |
|
| 8 | - * @author Automattic |
|
| 9 | - * @package Sensei |
|
| 10 | - * @category Templates |
|
| 11 | - * @version 1.9.0 |
|
| 12 | - */ |
|
| 4 | + * The Template for outputting Lesson Archive items |
|
| 5 | + * |
|
| 6 | + * Override this template by copying it to yourtheme/sensei/loop-lesson.php |
|
| 7 | + * |
|
| 8 | + * @author Automattic |
|
| 9 | + * @package Sensei |
|
| 10 | + * @category Templates |
|
| 11 | + * @version 1.9.0 |
|
| 12 | + */ |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <?php |
| 16 | 16 | /** |
| 17 | - * This runs before the post type items in the loop-lesson.php template. |
|
| 18 | - * |
|
| 19 | - * @since 1.9 |
|
| 20 | - */ |
|
| 17 | + * This runs before the post type items in the loop-lesson.php template. |
|
| 18 | + * |
|
| 19 | + * @since 1.9 |
|
| 20 | + */ |
|
| 21 | 21 | do_action( 'sensei_loop_lesson_before' ); |
| 22 | 22 | ?> |
| 23 | 23 | |
| 24 | 24 | <section class="lesson-container" > |
| 25 | 25 | |
| 26 | 26 | <?php |
| 27 | - /** |
|
| 28 | - * This runs before the lesson items in the loop-lesson.php template. |
|
| 29 | - * |
|
| 30 | - * @since 1.9.0 |
|
| 31 | - * |
|
| 32 | - * @hooked Sensei()->lesson->lesson_tag_archive_description - 11 |
|
| 33 | - * @hooked Sensei()->lesson->the_archive_header - 20 |
|
| 34 | - */ |
|
| 35 | - do_action( 'sensei_loop_lesson_inside_before' ); |
|
| 36 | - ?> |
|
| 27 | + /** |
|
| 28 | + * This runs before the lesson items in the loop-lesson.php template. |
|
| 29 | + * |
|
| 30 | + * @since 1.9.0 |
|
| 31 | + * |
|
| 32 | + * @hooked Sensei()->lesson->lesson_tag_archive_description - 11 |
|
| 33 | + * @hooked Sensei()->lesson->the_archive_header - 20 |
|
| 34 | + */ |
|
| 35 | + do_action( 'sensei_loop_lesson_inside_before' ); |
|
| 36 | + ?> |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | - //Loop through all lessons |
|
| 41 | - while ( have_posts() ) { the_post(); |
|
| 40 | + //Loop through all lessons |
|
| 41 | + while ( have_posts() ) { the_post(); |
|
| 42 | 42 | |
| 43 | - sensei_load_template_part( 'content', 'lesson' ); |
|
| 43 | + sensei_load_template_part( 'content', 'lesson' ); |
|
| 44 | 44 | |
| 45 | - } |
|
| 46 | - ?> |
|
| 45 | + } |
|
| 46 | + ?> |
|
| 47 | 47 | |
| 48 | 48 | <?php |
| 49 | - /** |
|
| 50 | - * This runs inside the <ul> after the lesson items in the loop-lesson.php template. |
|
| 51 | - * |
|
| 52 | - * @since 1.9.0 |
|
| 53 | - */ |
|
| 54 | - do_action( 'sensei_loop_lesson_inside_after' ); |
|
| 55 | - ?> |
|
| 49 | + /** |
|
| 50 | + * This runs inside the <ul> after the lesson items in the loop-lesson.php template. |
|
| 51 | + * |
|
| 52 | + * @since 1.9.0 |
|
| 53 | + */ |
|
| 54 | + do_action( 'sensei_loop_lesson_inside_after' ); |
|
| 55 | + ?> |
|
| 56 | 56 | |
| 57 | 57 | </section> |
| 58 | 58 | |
| 59 | 59 | <?php |
| 60 | 60 | /** |
| 61 | - * This runs after the lesson items <ul> in the loop-lesson.php template. |
|
| 62 | - * |
|
| 63 | - * @since 1.9.0 |
|
| 64 | - */ |
|
| 61 | + * This runs after the lesson items <ul> in the loop-lesson.php template. |
|
| 62 | + * |
|
| 63 | + * @since 1.9.0 |
|
| 64 | + */ |
|
| 65 | 65 | do_action( 'sensei_loop_lesson_after' ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * The Template for outputting Lesson Archive items |
| 5 | 5 | * |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @since 1.9 |
| 20 | 20 | */ |
| 21 | -do_action( 'sensei_loop_lesson_before' ); |
|
| 21 | +do_action('sensei_loop_lesson_before'); |
|
| 22 | 22 | ?> |
| 23 | 23 | |
| 24 | 24 | <section class="lesson-container" > |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | * @hooked Sensei()->lesson->lesson_tag_archive_description - 11 |
| 33 | 33 | * @hooked Sensei()->lesson->the_archive_header - 20 |
| 34 | 34 | */ |
| 35 | - do_action( 'sensei_loop_lesson_inside_before' ); |
|
| 35 | + do_action('sensei_loop_lesson_inside_before'); |
|
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | 40 | //Loop through all lessons |
| 41 | - while ( have_posts() ) { the_post(); |
|
| 41 | + while (have_posts()) { the_post(); |
|
| 42 | 42 | |
| 43 | - sensei_load_template_part( 'content', 'lesson' ); |
|
| 43 | + sensei_load_template_part('content', 'lesson'); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | ?> |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @since 1.9.0 |
| 53 | 53 | */ |
| 54 | - do_action( 'sensei_loop_lesson_inside_after' ); |
|
| 54 | + do_action('sensei_loop_lesson_inside_after'); |
|
| 55 | 55 | ?> |
| 56 | 56 | |
| 57 | 57 | </section> |
@@ -62,4 +62,4 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @since 1.9.0 |
| 64 | 64 | */ |
| 65 | -do_action( 'sensei_loop_lesson_after' ); |
|
| 65 | +do_action('sensei_loop_lesson_after'); |
|
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * Pagination - Lesson |
| 5 | 5 | * |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | global $post; |
| 13 | -$nav_id_array = sensei_get_prev_next_lessons( $post->ID ); |
|
| 14 | -$previous_lesson_id = absint( $nav_id_array['prev_lesson'] ); |
|
| 15 | -$next_lesson_id = absint( $nav_id_array['next_lesson'] ); |
|
| 13 | +$nav_id_array = sensei_get_prev_next_lessons($post->ID); |
|
| 14 | +$previous_lesson_id = absint($nav_id_array['prev_lesson']); |
|
| 15 | +$next_lesson_id = absint($nav_id_array['next_lesson']); |
|
| 16 | 16 | // Output HTML |
| 17 | -if ( ( 0 < $previous_lesson_id ) || ( 0 < $next_lesson_id ) ) { ?> |
|
| 17 | +if ((0 < $previous_lesson_id) || (0 < $next_lesson_id)) { ?> |
|
| 18 | 18 | <nav id="post-entries" class="post-entries fix"> |
| 19 | - <?php if ( 0 < $previous_lesson_id ) { ?><div class="nav-prev fl"><a href="<?php echo esc_url( get_permalink( $previous_lesson_id ) ); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title( $previous_lesson_id ); ?></a></div><?php } ?> |
|
| 20 | - <?php if ( 0 < $next_lesson_id ) { ?><div class="nav-next fr"><a href="<?php echo esc_url( get_permalink( $next_lesson_id ) ); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title( $next_lesson_id ); ?></a></div><?php } ?> |
|
| 19 | + <?php if (0 < $previous_lesson_id) { ?><div class="nav-prev fl"><a href="<?php echo esc_url(get_permalink($previous_lesson_id)); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title($previous_lesson_id); ?></a></div><?php } ?> |
|
| 20 | + <?php if (0 < $next_lesson_id) { ?><div class="nav-next fr"><a href="<?php echo esc_url(get_permalink($next_lesson_id)); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title($next_lesson_id); ?></a></div><?php } ?> |
|
| 21 | 21 | </nav><!-- #post-entries --> |
| 22 | 22 | <?php } ?> |
| 23 | 23 | \ No newline at end of file |
@@ -7,10 +7,10 @@ |
||
| 7 | 7 | * @version 1.1.0 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 10 | +if ( ! defined('ABSPATH')) exit; |
|
| 11 | 11 | |
| 12 | 12 | ?> |
| 13 | 13 | <nav id="post-entries" class="post-entries fix"> |
| 14 | - <div class="nav-prev fl"><?php previous_post_link( '%link', '<span class="meta-nav"></span> %title' ); ?></div> |
|
| 15 | - <div class="nav-next fr"><?php next_post_link( '%link', '%title <span class="meta-nav"></span>' ); ?></div> |
|
| 14 | + <div class="nav-prev fl"><?php previous_post_link('%link', '<span class="meta-nav"></span> %title'); ?></div> |
|
| 15 | + <div class="nav-next fr"><?php next_post_link('%link', '%title <span class="meta-nav"></span>'); ?></div> |
|
| 16 | 16 | </nav><!-- #post-entries --> |
| 17 | 17 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | /** |
| 4 | 4 | * Pagination - Lesson |
| 5 | 5 | * |
@@ -9,14 +9,14 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | global $post; |
| 12 | -$quiz_lesson = absint( get_post_meta( $post->ID, '_quiz_lesson', true ) ); |
|
| 13 | -$nav_id_array = sensei_get_prev_next_lessons( $quiz_lesson ); |
|
| 14 | -$previous_lesson_id = absint( $nav_id_array['prev_lesson'] ); |
|
| 15 | -$next_lesson_id = absint( $nav_id_array['next_lesson'] ); |
|
| 12 | +$quiz_lesson = absint(get_post_meta($post->ID, '_quiz_lesson', true)); |
|
| 13 | +$nav_id_array = sensei_get_prev_next_lessons($quiz_lesson); |
|
| 14 | +$previous_lesson_id = absint($nav_id_array['prev_lesson']); |
|
| 15 | +$next_lesson_id = absint($nav_id_array['next_lesson']); |
|
| 16 | 16 | // Output HTML |
| 17 | -if ( ( 0 < $previous_lesson_id ) || ( 0 < $next_lesson_id ) ) { ?> |
|
| 17 | +if ((0 < $previous_lesson_id) || (0 < $next_lesson_id)) { ?> |
|
| 18 | 18 | <nav id="post-entries" class="post-entries fix"> |
| 19 | - <?php if ( 0 < $previous_lesson_id ) { ?><div class="nav-prev fl"><a href="<?php echo esc_url( get_permalink( $previous_lesson_id ) ); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title( $previous_lesson_id ); ?></a></div><?php } ?> |
|
| 20 | - <?php if ( 0 < $next_lesson_id ) { ?><div class="nav-next fr"><a href="<?php echo esc_url( get_permalink( $next_lesson_id ) ); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title( $next_lesson_id ); ?></a></div><?php } ?> |
|
| 19 | + <?php if (0 < $previous_lesson_id) { ?><div class="nav-prev fl"><a href="<?php echo esc_url(get_permalink($previous_lesson_id)); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title($previous_lesson_id); ?></a></div><?php } ?> |
|
| 20 | + <?php if (0 < $next_lesson_id) { ?><div class="nav-next fr"><a href="<?php echo esc_url(get_permalink($next_lesson_id)); ?>" rel="prev"><span class="meta-nav"></span> <?php echo get_the_title($next_lesson_id); ?></a></div><?php } ?> |
|
| 21 | 21 | </nav><!-- #post-entries --> |
| 22 | 22 | <?php } ?> |
| 23 | 23 | \ No newline at end of file |