forked from OpenDevelopmentMekong/wp-odm_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategory.php
More file actions
90 lines (84 loc) · 2.6 KB
/
category.php
File metadata and controls
90 lines (84 loc) · 2.6 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
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
<?php
get_header();
$term = $wp_query->queried_object;
$post_types = get_post_types(array(
'public' => true,
'_builtin' => false
));
$tax_post_types = array();
$selected_posttype = odm_get_post_types_for_category_page();
foreach($selected_posttype as $pt) {
if (in_array($pt, $post_types)){
$pt_tax = get_object_taxonomies($pt);
if(in_array($term->taxonomy, $pt_tax)) {
$tax_post_types[] = $pt;
}
}
}
?>
<div class="container category-container">
<section class="container">
<header class="row">
<div class="eight columns">
<?php
if($term->parent) :
$parent = get_term($term->parent, $term->taxonomy);
?>
<h3 class="parent-term"><a href="<?php echo get_term_link($parent); ?>"><?php echo $parent->name; ?></a></h3>
<?php
endif; ?>
<h1 class="archive-title"><?php single_cat_title(); ?></h1>
</div>
<div class="eight columns">
<?php get_template_part('section', 'query-actions'); ?>
</div>
</header>
</section>
<section class="container">
<div class="row">
<div class="sixteen columns">
<section class="tabbed-posts-section container">
<?php if(count($tax_post_types) > 1) : ?>
<nav id="tabbed-post-type-nav">
<ul>
<?php
$current_pt = isset($_GET['queried_post_type']) ? $_GET['queried_post_type'] : 'news-article';
foreach($tax_post_types as $pt) :
$pt = get_post_type_object($pt);
$title = $pt->labels->name;?>
<li <?php if($current_pt == $pt->name) echo 'class="active"'; ?>><a href="<?php echo add_query_arg(array('queried_post_type' => $pt->name)); ?>"><?php echo $title; ?></a></li>
<?php endforeach; ?>
</ul>
</nav>
<?php endif; ?>
<?php if(have_posts()) : ?>
<?php
$index = 1;
echo '<div class="row">';
while(have_posts()) : the_post();
odm_get_template('post-list-single-2-cols',array(
"post" => get_post(),
"show_meta" => true,
"show_source_meta" => true,
"show_thumbnail" => true,
"show_excerpt" => true,
"show_summary_translated_by_odc_team" => true,
"header_tag" => true
),true);
if ($index % 2 == 0):
echo '</div>';
echo '<div class="row">';
endif;
$index++;
endwhile;
echo '</div>';
?>
<?php else : ?>
<h3 style="padding: 0 20px 10px;"><?php _e('No results found.', 'odm'); ?></h3>
<?php endif; ?>
</section>
</div>
</div>
</section>
</div>
<?php get_footer(); ?>