Hard to help without the rest of the code, but try commenting out wp_reset_query(); and see if that helps. Based on the code you’ve provided, this line isn’t required.
It didn’t work but thanks for the edit! Here is the whole code:
<?php
/**
* The template for displaying Search Results pages
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1>
</header><!-- .page-header -->
<?php if (is_search()): ?>
<ul class="filterable-grid clearfix">
<li>
<a href="<?php the_permalink(); ?>" >
<figure class="bw">
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) : ?>
<?php the_post_thumbnail('houses, press, news'); ?>
<?php endif; ?>
<figcaption>
<?php
$args = array('number' => '1',);
$terms = wp_get_post_terms($post->ID, 'location', $args);
foreach( $terms as $term ){
echo get_the_title() , '</br> ', $term->name;
}
?>
</figcaption>
</figure>
</a>
</li>
<?php $count++; ?>
</ul>
<?php endif ?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();
?>
Aha! The Loop (http://codex.wordpress.org/The_Loop) is missing from this template. For reference, this is the search.php from 2014:
<?php
/**
* The template for displaying Search Results pages
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1>
</header><!-- .page-header -->
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
// Previous/next post navigation.
twentyfourteen_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();
Thanks that worked! I took my code and made it into a content-search.php template and used the 2014 search code and replaced
get_template_part( 'content', get_post_format() );
with
get_template_part( 'content-search', get_post_format() );
Thanks for your help