PluginProbe
Tutor LMS – eLearning and online course solution / 2.0.1
Tutor LMS – eLearning and online course solution v2.0.1
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
tutor / classes / Frontend.php

Frontend.php in Tutor LMS – eLearning and online course solution 2.0.1, at classes/Frontend.php

51 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Frontend class
4 *
5 * @author: themeum
6 * @author_uri: https://themeum.com
7 * @package Tutor
8 * @since v.1.5.2
9 */
10
11
12 namespace TUTOR;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 class Frontend {
19
20 public function __construct() {
21 add_action( 'after_setup_theme', array( $this, 'remove_admin_bar' ) );
22 add_filter( 'nav_menu_link_attributes', array( $this, 'add_menu_atts' ), 10, 3 );
23 // add_action('pre_get_posts', array($this, 'tutor_offset_courses'));
24 }
25 function tutor_offset_courses($query){
26 if (!is_admin() && $query->is_main_query() && is_archive(tutor()->course_post_type)) $query->set('offset', 0);
27 }
28 /**
29 * Remove admin bar based on option
30 */
31 function remove_admin_bar() {
32 $hide_admin_bar_for_users = (bool) get_tutor_option( 'hide_admin_bar_for_users' );
33 if ( ! current_user_can( 'administrator' ) && ! is_admin() && $hide_admin_bar_for_users ) {
34 show_admin_bar( false );
35 }
36 }
37
38 /**
39 * add_menu_atts
40 *
41 * @param mixed $atts
42 * @param mixed $item
43 * @param mixed $args
44 * @return void
45 */
46 function add_menu_atts( $atts, $item, $args ) {
47 $atts['onClick'] = 'return true';
48 return $atts;
49 }
50 }
51