| @@ -1,75 +1,75 @@ | ||
| 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 | -// echo '<div class="mb-current-tab"><label>'.esc_html( $section_data['title'] ).'</label></div>'; | |
| 46 | - } | |
| 47 | - ?> | |
| 48 | - <?php } ?> | |
| 49 | - | |
| 50 | - <ul class="learn-press-tabs__nav" data-tabs="<?php echo esc_attr( count( $visible_tabs ) ); ?>"> | |
| 51 | - <?php | |
| 52 | - foreach ( $sections as $section_key => $section_data ) { | |
| 53 | - if ( ! in_array( $section_key, $visible_tabs ) ) { | |
| 54 | - continue; | |
| 55 | - } | |
| 56 | - | |
| 57 | - $classes = array( 'learn-press-tabs__item', esc_attr( $section_key ) ); | |
| 58 | - | |
| 59 | - if ( $active_tab == $section_key ) { | |
| 60 | - $classes[] = 'active'; | |
| 61 | - } | |
| 62 | - | |
| 63 | - $section_slug = $profile->get_slug( $section_data, $section_key ); | |
| 64 | - $section_link = $profile->get_tab_link( $tab_key, $section_slug ); | |
| 65 | - ?> | |
| 66 | - | |
| 67 | - <li class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> | |
| 68 | - <a href="<?php echo esc_url_raw( $section_link ); ?>"><?php echo esc_html( $section_data['title'] ); ?></a> | |
| 69 | - </li> | |
| 70 | - | |
| 71 | - <?php } ?> | |
| 72 | - | |
| 73 | - </ul> | |
| 74 | -</div> | |
| 75 | - | |
| 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 | +// echo '<div class="mb-current-tab"><label>'.esc_html( $section_data['title'] ).'</label></div>'; | |
| 46 | + } | |
| 47 | + ?> | |
| 48 | + <?php } ?> | |
| 49 | + | |
| 50 | + <ul class="learn-press-tabs__nav" data-tabs="<?php echo esc_attr( count( $visible_tabs ) ); ?>"> | |
| 51 | + <?php | |
| 52 | + foreach ( $sections as $section_key => $section_data ) { | |
| 53 | + if ( ! in_array( $section_key, $visible_tabs ) ) { | |
| 54 | + continue; | |
| 55 | + } | |
| 56 | + | |
| 57 | + $classes = array( 'learn-press-tabs__item', esc_attr( $section_key ) ); | |
| 58 | + | |
| 59 | + if ( $active_tab == $section_key ) { | |
| 60 | + $classes[] = 'active'; | |
| 61 | + } | |
| 62 | + | |
| 63 | + $section_slug = $profile->get_slug( $section_data, $section_key ); | |
| 64 | + $section_link = $profile->get_tab_link( $tab_key, $section_slug ); | |
| 65 | + ?> | |
| 66 | + | |
| 67 | + <li class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> | |
| 68 | + <a href="<?php echo esc_url_raw( $section_link ); ?>"><?php echo esc_html( $section_data['title'] ); ?></a> | |
| 69 | + </li> | |
| 70 | + | |
| 71 | + <?php } ?> | |
| 72 | + | |
| 73 | + </ul> | |
| 74 | +</div> | |
| 75 | + | |