-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpart-challenges.php
More file actions
56 lines (54 loc) · 1.69 KB
/
Copy pathpart-challenges.php
File metadata and controls
56 lines (54 loc) · 1.69 KB
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
<div class="container cf home-challenges">
<?php
$featured_term = get_term_by('slug', 'featured', 'challenge-category');
$args = array(
'post_type' => 'challenge',
'tax_query' => array(
array(
'taxonomy' => 'challenge-category',
'field' => 'id',
'terms' => (int)$featured_term->term_id
)
),
'order' => 'DESC',
'numberposts' => '3'
);
$posts = get_posts($args);
if( count($posts) > 0 ) : ?>
<div class="box-intro">
<h3>Featured<br /> <strong>Challenges</strong></h3>
<p>
A curated list of challenges from Federal Government Departments and Agencies and other national partners.
</p>
<a href="<?php bloginfo('url');?>/challenges" class="btn btn-primary">View All Challenges</a>
</div>
<ul class="box-list challenge-list">
<?php
foreach($posts as $post) :
setup_postdata($post);
$length = 14;
?>
<li>
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>" class="thumb">
<?php
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnail' );
echo '<img src="' . $thumb['0'] . '" alt="" />';
?>
</a>
<?php
} else {
$length = 42;
}
?>
<div class="box-content">
<h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
<?php custom_excerpt($length); ?>
</div>
<a href="<?php the_permalink() ?>" class="btn btn-clr">View Challenge</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif;
wp_reset_query(); ?>
</div>