Skip to content

Commit

Permalink
Merge pull request #630 from themeum/harun
Browse files Browse the repository at this point in the history
tutor-frontend css class added to tutor pages
  • Loading branch information
shewa12 authored Dec 22, 2023
2 parents 83e0a8c + c65f3f0 commit 410e42f
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions classes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function frontend_scripts() {
* Enabling Sorting, draggable, droppable...
*/
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-touch-punch', array( 'jquery-ui-sortable' ) );
wp_enqueue_script( 'jquery-touch-punch', array( 'jquery-ui-sortable' ) ); //phpcs:ignore

// Plyr.
if ( is_single_course( true ) ) {
Expand Down Expand Up @@ -575,7 +575,7 @@ public function add_identifier_class_to_body( $classes ) {

// Add backend course editor identifier class to body.
if ( $course_builder_screen ) {
$to_add[] = is_admin() ? 'tutor-backend' : '';
$to_add[] = is_admin() ? 'tutor-backend' : 'tutor-frontend';
$to_add[] = ' tutor-screen-course-builder tutor-screen-course-builder-' . $course_builder_screen . ' ';
}

Expand All @@ -584,6 +584,31 @@ public function add_identifier_class_to_body( $classes ) {
$to_add[] = 'tutor-screen-frontend-dashboard';
}

if ( is_post_type_archive( tutor()->course_post_type ) ) {
$to_add[] = 'tutor-frontend';
}

if ( tutor_utils()->is_tutor_frontend_dashboard() ) {
$to_add[] = 'tutor-frontend';
}

if ( is_single() ) {
global $post;

$post_types = array(
tutor()->course_post_type,
tutor()->lesson_post_type,
tutor()->quiz_post_type,
tutor()->assignment_post_type,
tutor()->zoom_post_type,
tutor()->meet_post_type,
);

if ( isset( $post->post_type ) && in_array( $post->post_type, $post_types, true ) ) {
$to_add[] = 'tutor-frontend';
}
}

if ( is_admin() ) {
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
$base = ( $screen && is_object( $screen ) && property_exists( $screen, 'base' ) ) ? $screen->base : '';
Expand Down

0 comments on commit 410e42f

Please # to comment.