-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfront-page.php.bak
87 lines (72 loc) · 2.44 KB
/
front-page.php.bak
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
<?php get_header(); ?>
<secion id="blocks">
<div id="vimeo" class="project figure_block project-double">
<iframe src="http://player.vimeo.com/video/49452532?title=0&byline=0&portrait=0&color=00BDF2" width="1024" height="576" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a class="project figure_block intro" href="<?php the_field('link'); ?>" title="<?php the_field('link_text'); ?>">
<div>
<p><?php the_field('text'); ?></p>
<div class="figcaption">
<p><?php the_field('link_text'); ?></p>
</div>
</div>
</a>
<?php endwhile; endif; wp_reset_query(); ?>
<?php
$args = array(
'post_type' => 'projects',
'posts_per_page' => -1,
'post_status' => 'publish',
'orderby' => 'rand'
);
$projects = new WP_Query( $args );
while( $projects->have_posts() ) : $projects->the_post();
?>
<?php
$thumb = get_field('thumbnail');
$overlay = get_field('overlay');
$date = get_the_date();
$month = 60 * 60 * 24 * 30;
$new = NULL;
if ( ( strtotime("now") - strtotime( $date ) ) < $month ) {
$new = "new_project";
} else {
$new = false;
}
$terms = get_the_terms( $post->ID, 'type');
$count = count( $terms );
$i = 0;
$types = '';
$klasses = '';
$cs = false;
if ( $terms ) :
foreach( $terms as $cat ) {
$i++;
$klasses .= $cat->slug . ' ';
if ( $cat->slug !== 'case-study' ) {
$types .= $cat->name;
if ( $i < $count ) {
$types .= " + ";
}
} else {
$cs = true;
}
}
endif; // if terms
?>
<a class="project figure_block <?php echo $klasses; ?>" href="<?php the_permalink(); ?>">
<figure class="<?php echo ( $cs ) ? 'case_study' : ''; echo $new; ?>">
<img src="<?php echo $overlay['url']; ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" />
<figcaption>
<h2><?php the_title(); ?></h2>
<p><?php echo $types; ?></p>
<img class="overlay" src="<?php echo $thumb['url']; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />
</figcaption>
</figure>
</a>
<?php
endwhile;
?>
</section>
<?php get_footer(); ?>