-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-sfwd-courses.php
180 lines (159 loc) · 7.15 KB
/
archive-sfwd-courses.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
/**
* The template for displaying 404 pages (not found)
*
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
*
* @package BuddyBoss_Theme
*/
global $wp_query;
get_header();
$view = get_option( 'bb_theme_learndash_grid_list', 'grid' );
$class_grid_active = ( 'grid' === $view ) ? 'active' : '';
$class_list_active = ( 'list' === $view ) ? 'active' : '';
$class_grid_show = ( 'grid' === $view ) ? 'grid-view bb-grid' : '';
$class_list_show = ( 'list' === $view ) ? 'list-view bb-list' : '';
$args = array (
'post_type' => 'career',
'posts_per_page' => '-1'
);
$careers = Timber::get_posts( $args );
$context = Timber::get_context();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<div id="learndash-content" class="learndash-course-list has-medium-padding-top">
<form id="bb-courses-directory-form" class="bb-courses-directory" method="get" action="">
<?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; ?>
<input type="hidden" name="current_page" value="<?php echo esc_attr( $paged ); ?>" >
<div class="flex align-items-center bb-courses-header">
<h4 class="bb-title">Todos los cursos</h4>
<div id="courses-dir-search" class="bs-dir-search" role="search">
<div id="search-members-form" class="bs-search-form">
<label for="bs_members_search" class="bp-screen-reader-text"><?php _e( 'Search', 'buddyboss-theme' ); ?></label>
<input type="text" name="search" id="bs_members_search" value="<?php echo ! empty( $_GET['search'] ) ? $_GET['search'] : ''; ?>" placeholder="<?php _e( 'Search', 'buddyboss-theme' ); ?> <?php echo LearnDash_Custom_Label::get_label( 'courses' ) . '...'; ?>">
</div>
</div>
</div>
<nav class="courses-type-navs main-navs bp-navs dir-navs bp-subnavs">
<ul class="component-navigation courses-nav">
<?php
$navs = array(
'all' => __( 'All', 'buddyboss-theme' ) . ' ' . LearnDash_Custom_Label::get_label( 'courses' ) . '<span class="count">' . buddyboss_theme()->learndash_helper()->get_all_courses_count() . '</span>',
);
if ( is_user_logged_in() ) {
$navs['my-courses'] = __( 'My', 'buddyboss-theme' ) . ' ' . LearnDash_Custom_Label::get_label( 'courses' ) . '<span class="count">' . buddyboss_theme()->learndash_helper()->get_my_courses_count() . '</span>';
}
$navs = apply_filters( 'BuddyBossTheme/Learndash/Archive/Navs', $navs );
if ( ! empty( $navs ) ) {
$current_nav = isset( $_GET['type'] ) && isset( $navs[ $_GET['type'] ] ) ? $_GET['type'] : 'all';
$base_url = get_post_type_archive_link( 'sfwd-courses' );
foreach ( $navs as $nav => $text ) {
$selected_class = $nav == $current_nav ? 'selected' : '';
$url = 'all' != $nav ? add_query_arg( array( 'type' => $nav ), $base_url ) : $base_url;
printf( "<li id='courses-{$nav}' class='{$selected_class}'><a href='%s'>%s</a></li>", $url, $text );
}
} else {
$current_nav = 'all';
}
?>
</ul>
</nav>
<input type="hidden" name="type" value="<?php echo esc_attr( $current_nav ); ?>" >
<div class="ld-secondary-header">
<div class="bb-secondary-list-tabs flex align-items-center" id="subnav" aria-label="Members directory secondary navigation" role="navigation">
<input type="hidden" id="course-order" name="order" value="<?php echo ! empty( $_GET['order'] ) ? $_GET['order'] : 'desc'; ?>"/>
<div class="sfwd-courses-filters flex push-right">
<div class="select-wrap">
<select id="sfwd_prs-order-by" name="orderby">
<?php echo buddyboss_theme()->learndash_helper()->print_sorting_options(); ?>
</select>
</div>
<?php if ( buddyboss_theme_get_option( 'learndash_course_index_show_categories_filter' ) ) : ?>
<div class="select-wrap">
<?php if ( '' !== trim( buddyboss_theme()->learndash_helper()->print_categories_options() ) ) { ?>
<select id="sfwd_cats-order-by" name="filter-categories">
<?php echo buddyboss_theme()->learndash_helper()->print_categories_options(); ?>
</select>
<?php } ?>
</div>
<?php endif; ?>
<?php if ( buddyboss_theme_get_option( 'learndash_course_index_show_instructors_filter' ) ) : ?>
<div class="select-wrap">
<select id="sfwd_instructors-order-by" name="filter-instructors">
<?php echo buddyboss_theme()->learndash_helper()->print_instructors_options(); ?>
</select>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="grid-view bb-grid has-small-padding-top">
<div id="course-dir-list" class="course-dir-list bs-dir-list">
<?php
if ( have_posts() ) {
?>
<ul class="bb-course-items <?php echo esc_attr( $class_grid_show . $class_list_show ); ?>" aria-live="assertive" aria-relevant="all">
<?php
//ARKDE extra putting the career card
foreach ($careers as $career) {
$career_ctx["career"] =$career;
$wc_product = get_field("wc_product",$career->ID);
$product = wc_get_product( $wc_product->ID );
$career_ctx["career_price"] = $product->get_price();
$career_ctx["career_id"] = $product->get_id();
?>
<li class="bb-course-item-wrap">
<?php Timber::render('cards/career.twig',$career_ctx); ?>
</li>
<?php }
/* Start the Loop */
while ( have_posts() ) :
the_post();
if(get_field("info",$post->ID)["visible"])
{
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'learndash/ld30/template-course-item' );
}
endwhile;
?>
</ul>
<div class="bb-lms-pagination">
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
$translated = __( 'Page', 'buddyboss-theme' ); // Supply translatable string
echo paginate_links(
array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'before_page_number' => '<span class="screen-reader-text">' . $translated . ' </span>',
)
);
?>
</div>
<?php
} else {
?>
<aside class="bp-feedback bp-template-notice ld-feedback info">
<span class="bp-icon" aria-hidden="true"></span>
<p><?php _e( 'Sorry, no courses were found.', 'buddyboss-theme' ); ?></p>
</aside>
<?php
}
?>
</div>
</div>
</form>
</div>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar( 'learndash' ); ?>
<?php
get_footer();