-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategory.php
More file actions
49 lines (40 loc) · 1.5 KB
/
category.php
File metadata and controls
49 lines (40 loc) · 1.5 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
<?php
get_header();
$current_category = get_queried_object();
$featured_post_id = get_field('featured_post', 'category_' . $current_category->term_id);
?>
<?php if ($featured_post_id): ?>
<!-- Featured Post Display -->
<?
$featured_query = new WP_Query(array(
'p' => $featured_post_id,
'post_type' => 'post'
));
if ($featured_query->have_posts()):
while ($featured_query->have_posts()): $featured_query->the_post();
get_template_part('template-parts/sections/single-post');
endwhile;
wp_reset_postdata();
endif;
?>
<?php else: ?>
<!-- Regular Category Display -->
<?php get_template_part('template-parts/components/category-header'); ?>
<?php get_template_part('template-parts/sections/blog-menu'); ?>
<section class="category-latest">
<div class="c">
<div class="grid-50 clear-col-3">
<?php while (have_posts()): the_post(); ?>
<div class="col-1-3">
<?php get_template_part('template-parts/components/article', null, ['class' => 'block']); ?>
</div><!-- col-1-3 -->
<?php endwhile; ?>
<div class="clear">
<?php the_posts_pagination(); ?>
</div>
</div><!-- grid -->
</div><!-- c -->
</section><!-- category-latest -->
<?php get_template_part('template-parts/sections/newsletter'); ?>
<?php endif; ?>
<?php get_footer(); ?>`