Skip to content

Instantly share code, notes, and snippets.

@creativeartbd
Last active July 13, 2023 16:13
Show Gist options
  • Save creativeartbd/d9c0c7dcaae0e7dc227d41e782bcdbef to your computer and use it in GitHub Desktop.
Save creativeartbd/d9c0c7dcaae0e7dc227d41e782bcdbef to your computer and use it in GitHub Desktop.
Enable filter option on Docent Pro Theme - Currently, On the Docent Pro theme, the filter is not showing after enable the filter option from the tutor settings. Because there is no code available for the filter. So you may replace this file from this location: wp-contents/themes/docent-pro/tutor folder.
<?php
get_header();
get_template_part('lib/sub-header'); ?>
<div class="<?php tutor_container_classes() ?>">
<div class="tutor-archive">
<?php
$course_filter = (bool) tutor_utils()->get_option('course_archive_filter', false);
$supported_filters = tutor_utils()->get_option('supported_course_filters', array());
if ($course_filter && count($supported_filters)) {
?>
<div class="tutor-course-filter-wrapper">
<div class="tutor-course-filter-container">
<?php tutor_load_template('course-filter.filters'); ?>
</div>
<div>
<div class="<?php tutor_container_classes(); ?> tutor-course-filter-loop-container" data-column_per_row="<?php echo tutor_utils()->get_option( 'courses_col_per_row', 4 ); ?>">
<?php tutor_load_template('archive-course-init'); ?>
</div><!-- .wrap -->
</div>
</div>
<?php
} else {
do_action('tutor_course/archive/before_loop');
if ( have_posts() ) : ?>
<div class="thm-grid-items-3 thm-grid-items">
<?php while ( have_posts() ) : the_post();
$src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'docent-proportfo');
$is_wishlisted = tutor_utils()->is_wishlisted(get_the_ID());
$has_wish_list = '';
if ($is_wishlisted){
$has_wish_list = 'has-wish-listed';
} ?>
<div class="tutor-course-grid-item">
<div class="tutor-course-grid-content">
<div class="tutor-course-overlay">
<img src="<?php echo $src[0]; ?>" class="img-responsive" />
<div class="tutor-course-grid-level-wishlist">
<span class="tutor-course-grid-level"><?php echo get_tutor_course_level(); ?></span>
<span class="tutor-course-grid-wishlist tutor-course-wishlist">
<a href="javascript:;" class="tutor-icon-fav-line tutor-course-wishlist-btn <?php echo $has_wish_list; ?>" data-course-id="<?php echo get_the_ID(); ?>"></a>
</span>
</div>
<div class="tutor-course-grid-enroll"><a href="<?php echo esc_url(get_the_permalink()); ?>" class="btn btn-classic btn-no-fill"><?php echo __('View Details','docent-pro'); ?></a></div>
</div>
<h3 class="tutor-courses-grid-title"><a href="<?php echo esc_url(get_the_permalink()); ?>"><?php echo get_the_title(); ?></a></h3>
<div class="tutor-courses-grid-price">
<?php echo tutor_course_price(); ?>
</div>
</div>
</div>
<?php
endwhile; ?>
</div>
<?php
else :
tutor_load_template('course-none');
endif;
do_action('tutor_course/archive/after_loop');
global $wp_query;
$docent_pro_page_numb = max( 1, get_query_var('paged') );
$docent_pro_max_page = $wp_query->max_num_pages;
echo wp_kses_post(docent_pro_pagination( $docent_pro_page_numb, $docent_pro_max_page ));
}
?>
</div><!-- .container -->
</div><!-- .wrap -->
<?php get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment