-
Notifications
You must be signed in to change notification settings - Fork 2
/
section-tracks.php
80 lines (74 loc) · 2.48 KB
/
section-tracks.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
<?php
$tracks_query = new WP_Query(array(
'post_type' => 'track',
'posts_per_page' => 10,
'meta_query' => array(
array(
'key' => 'featured',
'value' => 1
)
)
));
if($tracks_query->have_posts()) :
?>
<section id="tracks" class="row anti-row">
<div class="container">
<div class="row">
<div class="four columns">
<p class="pre-title"><?php _e('Introducing', 'toolkit'); ?></p>
<h2 class="htitle"><?php _e('TRACKS'); ?></h2>
<p class="tracks-description"><?php _e('Our thematic tracks helps you to follow the best tutorials for your level of knowledge and are tailored to your interest. You can choose a tool, a topic, a skill or even a region to explore our resources.', 'toolkit'); ?></p>
</div>
<div class="four columns">
<h3 class="htitle"><?php _e('Featured tracks'); ?></h3>
<ul class="track-list">
<?php
while($tracks_query->have_posts()) :
$tracks_query->the_post();
?>
<li id="track-<?php the_ID(); ?>" class="track-list-item" data-postid="<?php the_ID(); ?>">
<article>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
</article>
</li>
<?php
wp_reset_postdata();
endwhile;
?>
</ul>
</div>
<div class="four columns">
<?php
while($tracks_query->have_posts()) :
$tracks_query->the_post();
?>
<div id="track-details-<?php the_ID(); ?>" class="track-details">
<div class="no-title"></div>
<div class="single-track">
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p class="track-description"><?php echo get_the_excerpt(); ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php _e('Continue reading', 'toolkit'); ?></a></p>
<p class="track-tutorials"><?php printf(__('This track has <strong>%s</strong> tutorials', 'toolkit'), toolkit_get_track_tutorials_count()); ?></p>
</div>
</div>
<?php
wp_reset_postdata();
endwhile;
?>
</div>
</div>
</div>
</section>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.track-details').hide();
$('.track-list-item').on('click', function() {
$('.track-list-item').removeClass('active');
$(this).addClass('active');
$('.track-details').hide();
$('#track-details-' + $(this).data('postid')).show();
});
$('.track-list-item:first-child').click();
});
</script>
<?php endif; ?>