Created
October 2, 2017 13:49
-
-
Save GitFrankie/d797d706ccc2f1fb01c4ec17b3b3b568 to your computer and use it in GitHub Desktop.
search.php with SearchWP and Download Monitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 /* Search Count */ $allsearch = &new WP_Query("s=$s&posts_per_page=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">"'); echo $key; _e('"</span>'); _e(' returned '); echo $count . ' '; _e('articles'); wp_reset_query(); ?></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 »</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 »" 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