コード例 #1
0
?>
</h1>
        <?php 
edit_post_link(__('Edit', 'foghorn'), '<span class="edit-link">', '</span>');
?>

	</header><!-- .entry-header -->

	<div class="entry-content">
		<?php 
get_content_for_tax_archive('library');
?>

		<h2>Topics</h2>
		<?php 
get_custom_taxonomy_list('library-categories');
?>

		<?php 
//The custom taxonomy that will be queried
$taxonomy = 'library-categories';
$custom_post_type = 'library';
$custom_terms = get_terms($taxonomy);
foreach ($custom_terms as $custom_term) {
    wp_reset_query();
    $args = array('post_type' => $custom_post_type, 'tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $custom_term->slug)));
    $loop = new WP_Query($args);
    if ($loop->have_posts()) {
        //The topic heading
        echo '<h2 class="category-title" id="' . $custom_term->slug . '">' . $custom_term->name . '</h2>';
        //The resource listings for the topic
コード例 #2
0
?>
</h1>
        <?php 
edit_post_link(__('Edit', 'foghorn'), '<span class="edit-link">', '</span>');
?>

	</header><!-- .entry-header -->

	<div class="entry-content">
		<?php 
get_content_for_tax_archive('resources');
?>

		<h2>Topics</h2>
		<?php 
get_custom_taxonomy_list('resource-categories');
?>

		<?php 
//The custom taxonomy that will be queried
$taxonomy = 'resource-categories';
$custom_post_type = 'resources';
$custom_terms = get_terms($taxonomy);
foreach ($custom_terms as $custom_term) {
    wp_reset_query();
    $args = array('post_type' => $custom_post_type, 'tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $custom_term->slug)));
    $loop = new WP_Query($args);
    if ($loop->have_posts()) {
        //The topic heading
        echo '<h2 class="category-title" id="' . $custom_term->slug . '">' . $custom_term->name . '</h2>';
        //The resource listings for the topic