PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.2.0
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.2.0
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / templates / profile / tabs / sections.php

sections.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.2.0, at templates/profile/tabs/sections.php

79 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for displaying sections in the top of user profile tab content.
4 *
5 * This template can be overridden by copying it to yourtheme/learnpress/tabs/sections.php.
6 *
7 * @author ThimPress
8 * @package Learnpress/Templates
9 * @version 4.0.2
10 */
11
12 defined( 'ABSPATH' ) || exit();
13
14 $profile = LP_Profile::instance();
15
16
17 if ( ! isset( $tab_key, $tab_data ) ) {
18 return;
19 }
20
21 if ( empty( $tab_data->get( 'sections' ) ) || ( sizeof( $tab_data->get( 'sections' ) ) < 2 ) ) {
22 return;
23 }
24
25 $link = $profile->get_tab_link( $tab_key );
26 $unique_group = uniqid( 'course-tab-' );
27 $sections = $tab_data->get( 'sections' );
28 $visible_tabs = array();
29 $active_tab = '';
30 ?>
31
32 <div class="learn-press-tabs">
33 <?php
34 foreach ( $sections as $section_key => $section_data ) {
35 if ( $profile->is_hidden( $section_data ) ) {
36 continue;
37 }
38
39 $visible_tabs[] = $section_key;
40 $checked = '';
41
42 if ( $profile->is_current_section( $section_key, $section_key ) ) {
43 $active_tab = $section_key;
44 $checked = checked( true, true, false );
45 }
46 ?>
47
48 <input type="radio" name="<?php echo esc_attr( $unique_group ); ?>"
49 class="learn-press-tabs__checker" <?php echo esc_attr( $checked ); ?>
50 id="<?php echo esc_attr( $unique_group . '__' . $section_key ); ?>"/>
51 <?php } ?>
52
53 <ul class="learn-press-tabs__nav" data-tabs="<?php echo esc_attr( count( $visible_tabs ) ); ?>">
54 <?php
55 foreach ( $sections as $section_key => $section_data ) {
56 if ( ! in_array( $section_key, $visible_tabs ) ) {
57 continue;
58 }
59
60 $classes = array( 'learn-press-tabs__tab', esc_attr( $section_key ) );
61
62 if ( $active_tab == $section_key ) {
63 $classes[] = 'active';
64 }
65
66 $section_slug = $profile->get_slug( $section_data, $section_key );
67 $section_link = $profile->get_tab_link( $tab_key, $section_slug );
68 ?>
69
70 <li class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
71 <label><a href="<?php echo esc_url_raw( $section_link ); ?>"><?php echo esc_html( $section_data['title'] ); ?></a></label>
72 </li>
73
74 <?php } ?>
75
76 </ul>
77 </div>
78
79