This repository was archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag.php
85 lines (56 loc) · 2.02 KB
/
tag.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
<?php /* Templates for all archive includings tags, categories, dates, authors, etc. https://wphierarchy.com/ */
get_header(); ?>
<main id="main" class="main">
<?php // if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="header">
<div class="ucla campus">
<div class="col span_12_of_12">
<div class="breadcrumb"><?php get_breadcrumb(); ?></div>
<h1 class="entry-title"><?php single_term_title(); ?></h1>
</div>
</div>
</header>
<div class="ucla campus entry-content">
<div class="col span_7_of_12">
<div class="archive-meta"><?php if ( '' != the_archive_description() ) { echo esc_html( the_archive_description() ); } ?></div>
<?php
$tag = get_queried_object();
// Example argument that defines three posts per page.
$args = array(
'posts_per_page' => 0,
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => array(
$tag->slug,
),
),
),
);
// Variable to call WP_Query.
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
// Start the Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
// Loop Content
get_template_part( 'template-parts/content/content' );
// End the Loop
endwhile;
else:
// If no posts match this query, output this text.
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
wp_reset_postdata();
?>
</div>
<div class="col span_2_of_12"></div>
<div class="col span_3_of_12">
<?php dynamic_sidebar('Tags Widget Area'); ?>
</div>
</div>
<?php //endwhile; endif; ?>
</article>
</main>
<?php get_footer(); ?>