/** * Output the course archive filter markup * * hooked into sensei_loop_course_before * * @since 1.9.0 * @param */ public static function course_archive_filters($query) { // don't show on category pages if (is_tax('course-category')) { return; } /** * filter the course archive filter buttons * * @since 1.9.0 * @param array $filters{ * @type array ( $id, $url , $title ) * } * */ $filters = apply_filters('sensei_archive_course_filter_by_options', array(array('id' => 'all', 'url' => self::get_courses_page_url(), 'title' => __('All', 'woothemes-sensei')), array('id' => 'featured', 'url' => add_query_arg(array('course_filter' => 'featured'), self::get_courses_page_url()), 'title' => __('Featured', 'woothemes-sensei')))); ?> <ul class="sensei-course-filters clearfix" > <?php //determine the current active url $current_url = Sensei_Utils::get_current_url(); foreach ($filters as $filter) { $active_class = $current_url == $filter['url'] ? ' class="active" ' : ''; echo '<li><a ' . $active_class . ' id="' . $filter['id'] . '" href="' . esc_url($filter['url']) . '" >' . $filter['title'] . '</a></li>'; } ?> </ul> <?php }