Forums › Forums › Search & Filter Pro › Empty search result
Tagged: Empty Search
- This topic has 15 replies, 2 voices, and was last updated 10 years, 5 months ago by Ross.
-
Anonymous(Private) June 26, 2014 at 1:22 pm #1914
Hi, congratulations on your awesome plugin. I am still trying to figure it out a lot of things since I am a total beginner with WordPress, but it looks promising.
I purchased the pro version and I set some dropdowns filters and a submit button. I would like to set a different page with some text, a picture and buttons, etc, to be redirected to when I click on the button of “submit” and the result of my search is empty. I have seen a code (empty_search_url) in the non-pro version, but how can I do it with the pro version?
Thanks a lot
Ross Moderator(Private) June 26, 2014 at 7:52 pm #1929Hey Eduardo, there is no such code in the pro version, but thats because you don’t need it… want to send me your login details and I’ll take a look to see if you’re doing anything wrong?
You can do a private reply on these forums or send me a message via hte contact form:
http://www.designsandcode.com/contact
Thanks
Ross Moderator(Private) June 30, 2014 at 7:15 pm #1983Hey Eduardo
Ok so made some little adjustments
It is nearly always recommended that you use a custom template in order to make modifications the the results page – so I did this, and I set the the template to “category.php”.
What you will want to do is is duplicate “category.php” and call it something else, like “searchandfilter.php”, then update the settings in the plugin so the custom template is also “searchandfilter.php”.
Once this is set up, it is quite easy to display what you want when there is no results, as long as you are happy to create your own template.
Let me know when you have done this, and I can help you with the rest.
Thanks
Anonymous(Private) June 30, 2014 at 8:22 pm #1986Hi Ross,
Sorry for being such an ignorant, but I am afraid that I don’t follow you. I have looked for a file called category.php in my theme folder to duplicate it and rename it, but I don’t find any.
There is a file called portfolio-category.php, that I guess it is the template for the portfolio that is included in the theme Avada that I am using. Also, I have been doing a little bit of research and it seems that if I don’t have a file category.php I could use archive.php, or index.php, or page.php, but I am not sure about this and I don’t want to make a mess.
Is there any of these php files that I could use?
Thanks so much!
EduardoRoss Moderator(Private) June 30, 2014 at 9:17 pm #1987Hey Eduardo, yes you’re right, you can try archive, or index no problem, this is probably what it is defaulting to I just didn’t realise (nearly every theme has this)!
Try using those in the backend to see if you are happy with the results, and then duplicate the desired file as recommended above 🙂
Thanks
Ross Moderator(Private) July 3, 2014 at 12:53 am #2105Hey Eduardo
In your template you’ll have something like:
<?php if ( have_posts() ) : ?> <?php /* The loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php the_title(); ?> <?php endwhile; ?> <?php else : ?> No results found <?php endif; ?>
You just need to make sure you have an
else
in there which is if no results are found.Then you can put in any content you like in “No results Found”.. 🙂
Make sense? If not post the code from your template here and I’ll help you
Thanks
Anonymous(Private) July 3, 2014 at 1:37 pm #2130Sorry, but what I found is pretty different from what you posted.
This is the code from my template, duplicated from archive.php
<?php get_header(); ?>
<?php
$sidebar_exists = true;
$container_class = ”;
$post_class = ”;
$content_class = ”;if($smof_data[‘blog_archive_sidebar’] == ‘None’) {
$content_css = ‘width:100%’;
$sidebar_css = ‘display:none’;
$content_class= ‘full-width’;
$sidebar_exists = false;
} elseif($smof_data[‘blog_sidebar_position’] == ‘Left’) {
$content_css = ‘float:right;’;
$sidebar_css = ‘float:left;’;
} elseif($smof_data[‘blog_sidebar_position’] == ‘Right’) {
$content_css = ‘float:left;’;
$sidebar_css = ‘float:right;’;
}if($smof_data[‘blog_archive_layout’] == ‘Large Alternate’) {
$post_class = ‘large-alternate’;
} elseif($smof_data[‘blog_archive_layout’] == ‘Medium Alternate’) {
$post_class = ‘medium-alternate’;
} elseif($smof_data[‘blog_archive_layout’] == ‘Grid’) {
$post_class = ‘grid-post’;
$container_class = sprintf( ‘grid-layout grid-layout-%s’, $smof_data[‘blog_grid_columns’] );
} elseif($smof_data[‘blog_archive_layout’] == ‘Timeline’) {
$post_class = ‘timeline-post’;
$container_class = ‘timeline-layout’;
if($smof_data[‘blog_archive_sidebar’] != ‘None’) {
$container_class = ‘timeline-layout timeline-sidebar-layout’;
}
}
?>
<div id=”content” class=”<?php echo $content_class; ?>” style=”<?php echo $content_css; ?>”>
<?php if(category_description()): ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<div class=”post-content”>
<?php echo category_description(); ?>
</div>
</div>
<?php endif; ?>
<?php if($smof_data[‘blog_archive_layout’] == ‘Timeline’): ?>
<div class=”timeline-icon”><i class=”icon-comments-alt”></i></div>
<?php endif; ?>
<div id=”posts-container” class=”<?php echo $container_class; ?> clearfix”>
<?php
$post_count = 1;$prev_post_timestamp = null;
$prev_post_month = null;
$first_timeline_loop = false;while(have_posts()): the_post();
$post_timestamp = strtotime($post->post_date);
$post_month = date(‘n’, $post_timestamp);
$post_year = get_the_date(‘o’);
$current_date = get_the_date(‘o-n’);
?>
<?php if($smof_data[‘blog_archive_layout’] == ‘Timeline’): ?>
<?php if($prev_post_month != $post_month): ?>
<div class=”timeline-date”><h3 class=”timeline-title”><?php echo get_the_date($smof_data[‘timeline_date_format’]); ?></h3></div>
<?php endif; ?>
<?php endif; ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(‘post ‘ . $post_class.getClassAlign($post_count).’ clearfix’); ?>>
<?php if($smof_data[‘blog_archive_layout’] == ‘Medium Alternate’): ?>
<div class=”date-and-formats”>
<div class=”date-box”>
<span class=”date”><?php the_time($smof_data[‘alternate_date_format_day’]); ?></span>
<span class=”month-year”><?php the_time($smof_data[‘alternate_date_format_month_year’]); ?></span>
</div>
<div class=”format-box”>
<?php
switch(get_post_format()) {
case ‘gallery’:
$format_class = ‘images’;
break;
case ‘link’:
$format_class = ‘link’;
break;
case ‘image’:
$format_class = ‘image’;
break;
case ‘quote’:
$format_class = ‘quotes-left’;
break;
case ‘video’:
$format_class = ‘film’;
break;
case ‘audio’:
$format_class = ‘headphones’;
break;
case ‘chat’:
$format_class = ‘bubbles’;
break;
default:
$format_class = ‘pen’;
break;
}
?>
<i class=”icon-<?php echo $format_class; ?>”></i>
</div>
</div>
<?php endif; ?>
<?php
if($smof_data[‘featured_images’]):
if($smof_data[‘legacy_posts_slideshow’]) {
get_template_part(‘legacy-slideshow’);
} else {
get_template_part(‘new-slideshow’);
}
endif;
?>
<div class=”post-content-container”>
<?php if($smof_data[‘blog_archive_layout’] == ‘Timeline’): ?>
<div class=”timeline-circle”></div>
<div class=”timeline-arrow”></div>
<?php endif; ?>
<?php if($smof_data[‘blog_archive_layout’] != ‘Large Alternate’ && $smof_data[‘blog_archive_layout’] != ‘Medium Alternate’ && $smof_data[‘blog_archive_layout’] != ‘Grid’ && $smof_data[‘blog_archive_layout’] != ‘Timeline’): ?>
<h2 class=”entry-title”>“><?php the_title(); ?></h2>
<?php endif; ?>
<?php if($smof_data[‘blog_archive_layout’] == ‘Large Alternate’): ?>
<div class=”date-and-formats”>
<div class=”date-box”>
<span class=”date”><?php the_time($smof_data[‘alternate_date_format_day’]); ?></span>
<span class=”month-year”><?php the_time($smof_data[‘alternate_date_format_month_year’]); ?></span>
</div>
<div class=”format-box”>
<?php
switch(get_post_format()) {
case ‘gallery’:
$format_class = ‘images’;
break;
case ‘link’:
$format_class = ‘link’;
break;
case ‘image’:
$format_class = ‘image’;
break;
case ‘quote’:
$format_class = ‘quotes-left’;
break;
case ‘video’:
$format_class = ‘film’;
break;
case ‘audio’:
$format_class = ‘headphones’;
break;
case ‘chat’:
$format_class = ‘bubbles’;
break;
default:
$format_class = ‘pen’;
break;
}
?>
<i class=”icon-<?php echo $format_class; ?>”></i>
</div>
</div>
<?php endif; ?>
<div class=”post-content”>
<?php if($smof_data[‘blog_archive_layout’] == ‘Large Alternate’ || $smof_data[‘blog_archive_layout’] == ‘Medium Alternate’ || $smof_data[‘blog_archive_layout’] == ‘Grid’ || $smof_data[‘blog_archive_layout’] == ‘Timeline’): ?>
<h2 class=”post-title entry-title”>“><?php the_title(); ?></h2>
<?php if($smof_data[‘post_meta’] && ( ! $smof_data[‘post_meta_author’] || ! $smof_data[‘post_meta_date’] || ! $smof_data[‘post_meta_cats’] || ! $smof_data[‘post_meta_tags’] || ! $smof_data[‘post_meta_comments’] ) ): ?>
<?php if($smof_data[‘blog_archive_layout’] == ‘Grid’ || $smof_data[‘blog_archive_layout’] == ‘Timeline’): ?>
<p class=”single-line-meta vcard”><?php if(!$smof_data[‘post_meta_author’]): ?><?php echo __(‘By’, ‘Avada’); ?> <span class=”fn”><?php the_author_posts_link(); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_date’]): ?><span class=”updated” style=”display:none;”><?php the_modified_time( ‘c’ ); ?></span><span class=”published”><?php the_time($smof_data[‘date_format’]); ?></span><span class=”sep”>|</span><?php endif; ?></p>
<?php else: ?>
<p class=”single-line-meta vcard”><?php if(!$smof_data[‘post_meta_author’]): ?><?php echo __(‘By’, ‘Avada’); ?> <span class=”fn”><?php the_author_posts_link(); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_date’]): ?><span class=”updated” style=”display:none;”><?php the_modified_time( ‘c’ ); ?></span><span class=”published”><?php the_time($smof_data[‘date_format’]); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_cats’]): ?><?php if(!$smof_data[‘post_meta_tags’]){ echo __(‘Categories:’, ‘Avada’) . ‘ ‘; } ?><?php the_category(‘, ‘); ?><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_tags’]): ?><span class=”meta-tags”><?php echo __(‘Tags:’, ‘Avada’) . ‘ ‘; the_tags( ” ); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_comments’]): ?><?php comments_popup_link(__(‘0 Comments’, ‘Avada’), __(‘1 Comment’, ‘Avada’), ‘% ‘.__(‘Comments’, ‘Avada’)); ?><?php endif; ?></p>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php if( ( ! $smof_data[‘post_meta’] && $smof_data[‘excerpt_length_blog’] == ‘0’ ) || ( $smof_data[‘post_meta_author’] && $smof_data[‘post_meta_date’] && $smof_data[‘post_meta_cats’] && $smof_data[‘post_meta_tags’] && $smof_data[‘post_meta_comments’] && $smof_data[‘post_meta_read’] && $smof_data[‘excerpt_length_blog’] == ‘0’ ) ): ?>
<?php if( ! $smof_data[‘post_meta’] ): ?>
<div class=”no-content-sep”></div>
<?php endif; ?>
<?php else: ?>
<div class=”content-sep”></div>
<?php endif; ?>
<?php
if($smof_data[‘content_length’] == ‘Excerpt’) {
$stripped_content = tf_content( $smof_data[‘excerpt_length_blog’], $smof_data[‘strip_html_excerpt’] );
echo $stripped_content;
} else {
the_content(”);
}
?>
</div>
<div style=”clear:both;”></div>
<?php if($smof_data[‘post_meta’]): ?>
<div class=”meta-info”>
<?php if($smof_data[‘blog_archive_layout’] == ‘Grid’ || $smof_data[‘blog_archive_layout’] == ‘Timeline’): ?>
<?php if($smof_data[‘blog_archive_layout’] != ‘Large Alternate’ && $smof_data[‘blog_archive_layout’] != ‘Medium Alternate’): ?>
<div class=”alignleft”>
<?php if(!$smof_data[‘post_meta_read’]): ?>” class=”read-more”><?php echo __(‘Read More’, ‘Avada’); ?><?php endif; ?>
</div>
<?php endif; ?>
<div class=”alignright”>
<?php if(!$smof_data[‘post_meta_comments’]): ?><?php comments_popup_link(‘<i class=”icon-bubbles”></i> ‘.__(‘0’, ‘Avada’), ‘<i class=”icon-bubbles”></i> ‘.__(‘1’, ‘Avada’), ‘<i class=”icon-bubbles”></i> ‘.’%’); ?><?php endif; ?>
</div>
<?php else: ?>
<?php if($smof_data[‘blog_archive_layout’] != ‘Large Alternate’ && $smof_data[‘blog_archive_layout’] != ‘Medium Alternate’): ?>
<div class=”alignleft vcard”>
<?php if(!$smof_data[‘post_meta_author’]): ?><?php echo __(‘By’, ‘Avada’); ?> <span class=”fn”><?php the_author_posts_link(); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_date’]): ?><span class=”updated” style=”display:none;”><?php the_modified_time( ‘c’ ); ?></span><span class=”published”><?php the_time($smof_data[‘date_format’]); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_cats’]): ?><?php if(!$smof_data[‘post_meta_tags’]){ echo __(‘Categories:’, ‘Avada’) . ‘ ‘; } ?><?php the_category(‘, ‘); ?><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_tags’]): ?><span class=”meta-tags”><?php the_tags( ); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$smof_data[‘post_meta_comments’]): ?><?php comments_popup_link(__(‘0 Comments’, ‘Avada’), __(‘1 Comment’, ‘Avada’), ‘% ‘.__(‘Comments’, ‘Avada’)); ?><?php endif; ?>
</div>
<?php endif; ?>
<div class=”alignright”>
<?php if(!$smof_data[‘post_meta_read’]): ?>” class=”read-more”><?php echo __(‘Read More’, ‘Avada’); ?><?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php
$prev_post_timestamp = $post_timestamp;
$prev_post_month = $post_month;
$post_count++;
endwhile;
?>
</div>
<?php themefusion_pagination($pages = ”, $range = 2); ?>
</div>
<?php if( $sidebar_exists == true ): ?>
<?php wp_reset_query(); ?>
<div id=”sidebar” style=”<?php echo $sidebar_css; ?>”>
<?php
if ($smof_data[‘blog_archive_sidebar’] != ‘None’ && function_exists(‘dynamic_sidebar’)) {
generated_dynamic_sidebar($smof_data[‘blog_archive_sidebar’]);
}
?>
</div>
<?php endif; ?>
<?php get_footer(); ?> -
AuthorPosts