Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jchristopher/c1e084f8309934208863ffd6c506e782 to your computer and use it in GitHub Desktop.
search.php with SearchWP and Download Monitor
<?php get_header(); ?>
<!-- page content -->
<div class="pageWrap">
<div class="title-banner">
<div class="container">
<div class="mobile-wrap-page">
<h1>Search Results</h1>
</div>
</div>
</div>
<div class="single-post-wrap">
<div class="container">
<div class="c1">
<div class="mobile-wrap">
<h3>Your search for <?php echo esc_html( get_search_query() ); ?> returned <?php echo esc_html( $wp_query->found_posts ); ?> results</h3>
<ul class="results">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php if ($post->post_type == "contacts") { ?>
<strong><?php the_title(); ?></strong><br/>
<?php the_field('title');?><br/>
<?php the_field('address');?><br/>
<?php the_field('phone');?><br/>
<a href="mailto:<?php the_field('email');?>">Email &raquo;</a>
<?php } else if( $post->post_type == "dlm_download" ){ ?>
<li><a href="<?php $dlm_download->the_download_link(); ?>">Download: <?php echo $dlm_download->get_the_title(); ?></a></li>
<?php } else { ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php } ?>
<?php endwhile; endif; ?>
</ul>
</div>
</div>
<div class="c2">
<div class="mobile-wrap">
<h3>Try Another Search</h3>
<form method="get" action="<?php bloginfo('home'); ?>/">
<input type="text" id="search-results-form" onfocus="if (this.value == 'Search this blog') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search this blog';}" value="" name="s" /><input type="submit" value="Search &raquo;" id="search-btn"/></form>
</div>
</div>
</div>
</div>
</div>
<!-- / page content -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment