Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Monolith
- * WordPress Taxonomy Page
- * This page is the main archive for taxonomy terms. The loop is ran when the taxonomy term is queried via URL.
- */
- ?>
- <? $thisvar = get_query_var( 'taxonomy' );?>
- <? $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );?>
- <? $thatvar = $term->slug;?>
- <? $anothervar = get_post_type();?>
- <?php get_template_parts( array( 'parts/html-header', 'parts/header' ) ); ?>
- <div class="wrapper-main" role="main">
- <div class="<?= CONTAINER_CLASSES; ?>">
- <? get_template_part('parts/breadcrumb'); // load breadcrumb ?>
- <div class="<?= ROW_CLASSES ?>">
- <div class="<?= MAIN_SIZE ?>">
- <header class="page-header archive-header" itemprop="name">
- <?echo $anothervar?>
- <h1 class="archive-title h1">
- <?php echo single_term_title(); ?><?php if ( is_post_type_archive() ) { ?> <?php $obj = get_post_type_object( $anothervar );echo $obj->labels->name;?><?}?> <?php if ( !is_post_type_archive() ) { ?>Overview<?}?>
- </h1>
- </header>
- <?php if ( is_post_type_archive() ) { //this runs when a custom post type is viewed ex: ?post_type=articles?>
- <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
- <? // markup for post snippet, used in loops and queries ?>
- <article itemscope itemtype="http://schema.org/Article" <?php post_class(); ?>>
- <? if (has_post_thumbnail()) { ?><div class="thumbnail previewimg alignleft"><a href="<? the_permalink();?>"><? the_post_thumbnail( array(100,100) );?></a></div><?}?>
- <header class="snippet-title">
- <h2 class="snippet-headline" itemprop="name"><a href="<?= get_permalink() ?>" title="<?php the_title(); ?>" class="post-permalink" itemprop="url"><?php the_title(); ?></a></h2>
- </header>
- <section class="snippet-excerpt">
- <p itemprop="description"><?= get_the_excerpt(); ?></p>
- </section>
- <footer class="snippet-footer clearfix">
- <?php get_template_part('parts/meta/readmore'); ?>
- </footer> <!-- end article footer -->
- </article>
- <hr/>
- <?php endwhile; ?>
- <? elseif ( is_search() ) : // display an error if no search results are found ?>
- <div class="alert">No results found for '<?php echo get_search_query(); ?>'</div>
- <? else : ?>
- <div class="alert">There are no posts to display.</div>
- <?php endif; ?>
- <?php get_template_part('parts/pagination') // load the pagination part ?>
- <?} else {?>
- <div class="well well-small">
- <h3><?php echo single_term_title(); ?> Articles</h3>
- <?php query_posts(array('post_type' => 'article',$thisvar => $thatvar,'showposts' => 1 ) ); ?>
- <? if ( have_posts() ) : while ( have_posts() ) : the_post();?>
- <h4><a href="<? the_permalink();?>"><?php the_title(); ?></a></h4>
- <?php the_excerpt(); ?>
- <div class="navigation"><a href="?post_type=article">View all <?php echo single_term_title(); ?> Articles</a></div>
- <?php endwhile; else: ?>
- <p>No <? echo single_term_title(); ?> articles found.</p>
- <? endif; wp_reset_query(); ?>
- </div>
- <div class="well well-small">
- <h3><?php echo single_term_title(); ?> Businesses</h3>
- <?php query_posts(array('post_type' => 'location',$thisvar => $thatvar,'showposts' => 10 ) ); ?>
- <? if ( have_posts() ) : while ( have_posts() ) : the_post();?>
- <h4><a href="<? the_permalink();?>"><?php the_title(); ?></a></h4>
- <?php the_excerpt(); ?>
- <?php endwhile; else: ?>
- <p>No Businesses listed for <? echo single_term_title(); ?> at this time.</p>
- <? endif; wp_reset_query(); ?>
- </div>
- <div class="well well-small">
- <h3><?php echo single_term_title(); ?> Events</h3>
- <?php query_posts(array('post_type' => 'event',$thisvar => $thatvar,'showposts' => 10 ) ); ?>
- <? if ( have_posts() ) : while ( have_posts() ) : the_post();?>
- <h4><a href="<? the_permalink();?>"><?php the_title(); ?></a></h4>
- <?php the_excerpt(); ?>
- <?php endwhile; else: ?>
- <p>No Events listed for <? echo single_term_title(); ?> at this time.</p>
- <? endif; wp_reset_query(); ?>
- </div>
- <?php } ?>
- </div><!-- MAIN_SIZE -->
- <aside class="sidebar-right <?= SIDEBAR_SIZE?>" role="complementary">
- <section class="sidebar widget template-widget">
- <h3><?php echo single_term_title(); ?> Species</h3>
- <?php query_posts(array('post_type' => 'species',$thisvar => $thatvar,'showposts' => 10 ) ); ?>
- <? if ( have_posts() ) : while ( have_posts() ) : the_post();?>
- <div class="specie">
- <a class="thumbnail alignleft" href="<? the_permalink();?>"><? the_post_thumbnail("squared");?></a>
- <h4 class="clearfix"><a href="<? the_permalink();?>"><?php the_title(); ?></a></h4>
- </div>
- <?php endwhile;?>
- <a href="/<? echo $thisvar ?>/<? echo $thatvar ?>?post_type=species">View all <? echo single_term_title(); ?> Species</a>
- <?else: ?>
- <div class="specie">
- <p>No species listed for <? echo single_term_title(); ?>.</p>
- </div>
- <? endif; wp_reset_query(); ?>
- </section>
- <section class="widget widget-template">
- <h3><? echo single_term_title(); ?> Locations</h3>
- <div class="map"><?php echo do_shortcode('[mashup query="'.$thisvar.'='.$thatvar.'&posts_per_page=-1" width="100%" height="300" adaptive="true"]'); ?></div>
- </section>
- </aside>
- </div><!-- /ROW_CLASSES -->
- </div><!-- /CONTAINER_CLASSES -->
- </div><!-- /main -->
- <?php get_template_parts( array( 'parts/footer','parts/html-footer' ) ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement