Adding a “No Results Found” to a search filter output page

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Adding a “No Results Found” to a search filter output page



Having a bit of a mare with a custom template.
I have a filter which works well, unfortunately when it yields no results there's no indication that no results have been found. Im trying to display "No results found" when there's nothing to show...
I'm under the impression that the answer is going to be something along the lines of adding this to the end of the hook




<?php else : ?>
<p>There are no results</p>
<?php endif ?>



My php knowledge is minimal, stubbornly i've spent approx 2 days trying to fix after reading upon others solutions with no luck, i'm wondering if someone could shed a little light or if it can even be achieved.



Here's the current code.............




<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
<?php
wp_enqueue_style('my_kitchensnew3', get_template_directory_uri() . 'css/bootstrap.min.css');
wp_enqueue_style('my_kitchensnew3-1', get_template_directory_uri() . 'css/styles.css');
global $mdf_loop;
$zoom = 3;

if (isset($_REQUEST['meta_data_filter_args']['tax_query']))
{
$taxes = $_REQUEST['meta_data_filter_args']['tax_query'];
if (!empty($taxes))
{
foreach ($taxes as $value)
{
if (isset($value['taxonomy']) AND $value['taxonomy'] == 'locations')
{
$zoom = 11;
break;
}
}
}
}


echo do_shortcode('[mdf_gmap height="300" width="100" zoom="' . $zoom . '" maptype="TERRAIN" metakey="medafi_map"]');
echo '<br />';
MDTF_SORT_PANEL::mdtf_catalog_ordering();
?>

<div class="row previews">
<?php
while ($mdf_loop->have_posts()) : $mdf_loop->the_post();
?>
<div class="col-md-3">
<div class="thumbnail">
<?php
if (has_post_thumbnail($post->ID))
{
echo '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr($post->post_title) . '">';
echo '<img src="' . MDTF_HELPER::get_post_featured_image($post->ID, '350x300') . '" alt="" />';
echo '</a>';
}
?>

<div class="heart11"><p style="text-align: right;">
<?php echo do_shortcode('[favorite_button post_id="" site_id=""]') ?>
</p></div>

<div class="caption" style="max-height: 650px; text-align: left">
<h3><a href="<?php the_permalink() ?>" target="_blank"><?php the_title() ?></a></h3>




<br />

<div style="clear: both;"></div>
</div>
</div>
</div>
<?php endwhile; // end of the loop. ?>
</div>



Thanks in advance









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived