forked from greggsky/sandy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-resources.php
More file actions
64 lines (51 loc) · 1.79 KB
/
content-resources.php
File metadata and controls
64 lines (51 loc) · 1.79 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
<?php
/**
* The template used for displaying the Resourcs page content in page-custom.php
*
* @package WordPress
* @subpackage Foghorn
* @since Foghorn 0.1
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="leader"><?php the_title(); ?></h1>
<?php edit_post_link( __( 'Edit', 'foghorn' ), '<span class="edit-link">', '</span>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<h2>Topics</h2>
<!-- From functions.php - accepts the taxonomy name and outputs TOC-type nav -->
<?php get_custom_taxonomy_list ('resource_categories'); ?>
<?php
//Specify taxomony to be used
$taxonomy = 'resource_categories';
//Get array of taxonomy terms
$taxonomy_query = get_terms($taxonomy);
foreach ($taxonomy_query as $taxonomies => $taxonomy) {
//Display the taxonomy name as a heading with IDanchor
echo '<a id="' . $taxonomy->slug . '"></a><h2 class="category-title">' . $taxonomy->name . '</h2>';
echo '<ul class="library"><li class="entry-item">';
//Get array of posts for taxonomy term
$args = array(
'post_type' => 'resources',
'taxonomy' => 'resource_categories',
'term' => $taxonomy->name,
'orderby' => 'title',
'order' => 'ASC'
);
$post_query = new WP_Query($args);
if( $post_query->have_posts() ) {
while ($post_query->have_posts()) : $post_query->the_post(); ?>
<h3 class="item-title">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h3>
<?php the_content(); ?>
<?php endwhile;
}
echo '</li></ul>';
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->