-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage-tagged-content.php
82 lines (73 loc) · 2.26 KB
/
page-tagged-content.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
<?php
/**
* @package WordPress
* @subpackage skeleton
* Template Name: Page w/ Tagged Content
*/
?>
<?php include ("header.php") ?>
<!-- Begin Template: page-tagged-content.php -->
<div id="content">
<div class="wrapper">
<div class="section twothird left">
<div class="section full text">
<?php if (have_posts()) : while (have_posts()) : the_post();
$postid = $post->ID;
?>
<h1 class="pagetitle"><?php the_title(); ?></h1>
<?php the_content(__('')); ?>
<?php endwhile; else: endif; ?>
</div> <!-- END .section full text -->
</div> <!-- END .section twothird -->
<div class="section onethird right sidebar">
<div class="widgets list">
<?php include 'includes/page.sidebar.php'; ?>
</div> <!-- END .section -->
</div> <!-- END .section onethird -->
<div class="divider"></div>
<div class="section full tagged posts cards">
<h2 class="sectiontitle nocase">Related Resources</h2>
<?php $term_list = wp_get_post_terms($postid, 'content_tags', array("fields" => "names")); ?>
<?php
$args = array(
'posts_per_page' => 4,
'post_type' => 'resource',
'tax_query' => array(
array(
'taxonomy' => 'content_tags',
'field' => 'slug',
'terms' => $term_list
),
),
);
$i = 1;
$query = new WP_Query( $args );
if (have_posts()) : while ($query->have_posts()) : $query->the_post();
$resource_url = get_post_meta( $postid, 'resource_url', true );
if($resource_url == false){$resource_url = get_permalink($post->ID);}
?>
<div class="post post<?=$i?>">
<div class="pageImageThumb" >
<a href="<?=$resource_url ?>" rel="bookmark">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('resource');
}
?>
</a>
</div>
<div class="content">
<h2 class="title"><a href="<?=$resource_url ?>" ><?php the_title(); ?></a></h2>
</div>
</div> <!--END post post<?=$i?> -->
<?php
$i++;
endwhile;
endif;
wp_reset_postdata();
?>
</div> <!-- END .section full text -->
</div> <!-- END .wrapper -->
</div> <!-- END #content -->
<!-- End Template: page-tagged-content.php -->
<?php include ("footer.php") ?>