Forked from GitFrankie/gist:d797d706ccc2f1fb01c4ec17b3b3b568
Last active
October 2, 2017 13:58
Star
You must be signed in to star a gist
search.php with SearchWP and Download Monitor
This file contains 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 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 »</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