set up templates for taxonomy landing pages

This commit is contained in:
Evan Mullins 2023-01-30 11:31:32 -05:00
parent 0d0f058e3c
commit b355ffda22
5 changed files with 125 additions and 39 deletions

View file

@ -5,7 +5,7 @@
Author: Evan Mullins
Author URI: https://circlecube.com
Template: twentynineteen
Version: 1.12.4
Version: 1.12.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wasmo

View file

@ -0,0 +1,44 @@
<?php
/**
* Template part for displaying shelf taxonomy list
*/
?>
<!-- wp:heading {"level":3} -->
<h3>
<?php echo wasmo_get_icon_svg( 'question', 24 ); ?>
Mormon Questions:
</h3>
<!-- /wp:heading -->
<ul class="questions">
<li><a href="<?php echo home_url( '/why-i-left/' ); ?>" class="question">Why I left?</a></li>
<?php
// Answered Questions
$terms = get_terms([
'taxonomy' => 'question',
'hide_empty' => false,
'count' => true,
'orderby' => 'count',
'order' => 'DESC',
]);
// Array of WP_Term objects.
foreach ( $terms as $term ) {
$termid = $term->term_id;
// if has answers
if ( 0 < $term->count ) { ?>
<li>
<a
class="question question-<?php echo $termid; ?>"
href="<?php echo get_term_link( $termid ); ?>"
><?php echo $term->name; ?></a>
</li>
<?php } else { ?>
<li><?php echo $term->name; ?></li>
<?php
}
}
?>
</ul>

View file

@ -25,46 +25,14 @@ get_header();
endwhile; // End of the loop.
?>
<?php
// Answered Questions
$terms = get_terms([
'taxonomy' => 'question',
'hide_empty' => false,
'count' => true,
'orderby' => 'count',
'order' => 'DESC',
]);
?>
<article class="entry the-questions">
<section class="entry the-questions">
<div class="entry-content">
<ul class="questions">
<li><a href="<?php echo home_url( '/why-i-left/' ); ?>" class="question">Why I left?</a></li>
<?php
// Array of WP_Term objects.
foreach ( $terms as $term ) {
$termid = $term->term_id;
// if has answers
if ( 0 < $term->count ) {
?>
<li>
<a
class="question question-<?php echo $termid; ?>"
href="<?php echo get_term_link( $termid ); ?>"
><?php echo $term->name; ?></a>
</li>
<?php
} else {
?>
<li><?php echo $term->name; ?></li>
<?php
}
}
?>
</ul>
<?php get_template_part(
'template-parts/content/content',
'tax-question'
); ?>
</div>
</article>
</section>
</main><!-- #main -->
</section><!-- #primary -->

37
template-shelf.php Normal file
View file

@ -0,0 +1,37 @@
<?php
/**
* Template Name: Shelf
*
* The template for displaying the shelf taxonomy index
*
* @subpackage wasmo
* @since 1.0.0
*/
get_header();
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content/content', 'page' );
endwhile; // End of the loop.
?>
<section class="entry the-questions">
<div class="entry-content">
<?php get_template_part( 'template-parts/content/content', 'tax-shelf' ); ?>
</div>
</section>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_footer();

37
template-spectrum.php Normal file
View file

@ -0,0 +1,37 @@
<?php
/**
* Template Name: Spectrum
*
* The template for displaying the spectrum taxonomy index
*
* @subpackage wasmo
* @since 1.0.0
*/
get_header();
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content/content', 'page' );
endwhile; // End of the loop.
?>
<section class="entry the-questions">
<div class="entry-content">
<?php get_template_part( 'template-parts/content/content', 'tax-spectrum' ); ?>
</div>
</section>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_footer();