Skip to content

Instantly share code, notes, and snippets.

@mikeislearning
Created July 7, 2015 09:55
Show Gist options
  • Save mikeislearning/1ccae27eeac6430238f2 to your computer and use it in GitHub Desktop.
Save mikeislearning/1ccae27eeac6430238f2 to your computer and use it in GitHub Desktop.
search.php file for thepeopledoctor
<?php get_header(); ?>
<div class="entry-title">
Results for: <?php echo esc_html(stripslashes($_GET['s']), true); ?>
</div>
<div class="search-results-content">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2 class="archive-title results-page">Results Found</h2>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>
<div class="result-row">
<div class="col-large">
<div class="result-meta first">
<a href="<?php the_permalink() ?>" title="<?php the_title() ?>" class="post-title"><?php if( has_term( 'newsletter', 'drm-tax-content-type' ) ) echo 'The People&rsquo;s Doctor: '; ?> <?php the_title(); ?></a>
</div>
</div>
<div class="col-small">
<div class="result-meta">
<div class="col-header">Content Type</div>
<div class="result"><?php echo get_the_term_list( $post->ID, 'drm-tax-content-type', '', ', ' ); ?></div>
</div>
</div>
<div class="col-small">
<div class="result-meta">
<?php if ( has_term( 'newsletter', 'drm-tax-content-type' )) { // Newsletters ?>
<div class="col-header">Volume</div>
<div class="result"><?php echo types_render_field("volume", array('normal' => 'true')); ?></div>
<?php } elseif ( has_term( 'photograph', 'drm-tax-content-type' )) { // Photos ?>
<div class="col-header">Description</div>
<div class="result"><?php echo types_render_field("description", array('raw' => 'true')); ?></div>
<?php } else { // Default ?>
<div class="col-header">Publisher</div>
<div class="result"><?php echo types_render_field("publisher", array('normal' => 'true')); ?></div>
<?php } ?>
</div>
</div>
<div class="col-small">
<div class="result-meta">
<?php if( has_term( 'newsletter', 'drm-tax-content-type' ) ) { // Newsletters ?>
<div class="col-header">Issue</div>
<div class="result"><?php echo types_render_field("issue", array('normal' => 'true')); ?></div>
<?php } else { // Default ?>
<div class="col-header">Item Date</div>
<div class="result"><?php echo types_render_field("date", array('normal' => 'true', 'format' => 'F Y')); // With day = F j, Y ?></div>
<?php } ?>
</div>
</div>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="result-row no-results">Sorry, no items matched your criteria. Please try your search again.</div>
<?php endif; ?>
<a href="loadmore" class="list-action-button">Load More</a>
</div>
</div>
</div>
</div>
<?php get_footer() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment