The website I am busy working on was built by another company that no longer supports Wordpress so I am looking for help. Below is the PHP for the search function. From the research Ive done it seems they have used the standard Wordpress code. The client has asked that the search only results in the related product. At the moment it is pulls everything with the key phase such as blog posts and titles.
<?php get_header(); ?>
<div class="content pattern-background">
<div class="wrapper">
<h1>Search results:</h1>
<div class="product-list">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="product-list__item" >
<?php
if(has_post_thumbnail()) {
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
} else {
}
?>
<a class="product__image" href="<?php the_permalink() ?>" style="background-image: url(<?php echo $url; ?>);">
</a>
<div class="product__details">
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<p><?php the_excerpt(); ?></p>
<div class="divider-solid"></div>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h2>Sorry, no items found.</h2>
</div>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>
Can someone please guide me on what code to add or remove? or if there is documentation that can help.
This is a very important client so I am nervous to just play around until I get it right.
Thanks in advance