-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfront-page.php
109 lines (98 loc) · 2.99 KB
/
front-page.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
<?php
/**
* Home page template file.
*
* @package photo-addict
* @since photo-addict 1.0
*/
get_header(); ?>
<section class="content" role="main">
<?php $args = array(
'posts_per_page' => 12,
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-gallery' ),
'operator' => 'IN'
)
) );
$query = new WP_Query( $args );
if ($query->have_posts()) : ?>
<article>
<div class="image-block">
<?php while ($query->have_posts()) : $query->the_post(); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a>
<?php else : ?>
<a href="<?php the_permalink() ?>"><img src="<?php echo photo_addict_first_post_image_url( $post->ID, 'thumbnail' ); ?>" alt="<?php echo $post->post_title; ?>" /></a>
<?php endif;
endwhile; ?>
</div>
</article>
<?php endif; ?>
<article>
<ul>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'paged' => $paged,
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-status', 'post-format-image' , 'post-format-gallery' ),
'operator' => 'NOT IN'
)
) );
$query = new WP_Query( $args );
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
$ids[] = get_the_ID(); ?>
<li><a href="<?php the_permalink() ?>" <?php post_class(); ?>>
<?php // If the post doesn't have a title, print the month and day
if ( empty( $post->post_title ) ) :
echo the_date( get_option( 'date_format' ) );
else :
echo $post->post_title;
endif; ?>
</a></li>
<?php endwhile;
else :
get_template_part( 'no-results', 'index' );
endif; ?>
</ul>
<?php photo_addict_content_nav( 'nav-below' ); ?>
</article>
<?php
$args = array(
'posts_per_page' => 1,
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => 'post-format-status',
'operator' => 'IN'
)
) );
$query = new WP_Query( $args );
if ($query->have_posts()) : ?>
<article>
<?php while ($query->have_posts()) : $query->the_post();
// Look for an image associated with the post, fallback to the excerpt
$first_image = photo_addict_first_post_image_url( 'medium' );
if ( isset( $first_image ) ) : ?>
<a href="<?php the_permalink() ?>" class="post-format-status"><img src="<?php echo $first_image; ?>" alt="<?php echo $post->post_title; ?>" /><br><?php echo $post->post_title; ?></a>
<?php else : ?>
<a href="<?php the_permalink() ?>" class="post-format-status"><?php echo $post->post_title; ?></a>
<?php the_excerpt(); ?>
<?php endif;
endwhile; ?>
</article>
<?php endif; ?>
</section><!-- .content -->
<section class="side">
</section> <!-- .side -->
<?php
// echo photo_addict_color_css();
get_footer();
?>