Forums Forums Search & Filter Pro Is it possible to start the search form with no results?

Viewing 9 posts - 11 through 19 (of 19 total)
  • Trevor
    #79885

    Am I able to see this page live on the Internet?

    Anonymous
    #79971
    This reply has been marked as private.
    Trevor
    #80197

    From what I can see, you have made some changes to the results.php file. Can you paste the contents of the file here inside code tags?

    Anonymous
    #80206

    shure!

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(3552)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
    		echo "make your selection";
    } else {
    	if ( $query->have_posts() )
    {
    	echo "<div class=\"row\">";
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		?>
    			<div class="col-md-3 popmake-<?php the_ID();?> data-do-default="" style="cursor: pointer;">
    				<h3 style="text-align: center;"><?php the_title(); ?></h3>
    				<p style="text-align: center;"><?php do_shortcode(the_excerpt()); ?></p>
    			</div>
    	<?php
    	echo "</div>";
    	}
    }
    else
    {
    	echo "No Results Found";
    }
    }
    ?>
    Trevor
    #80210

    There were a couple of errors in that, so I have re-coded it (I am not sure about the do_shortcode bit, but I have left that as is):

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(3552)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
    		echo "make your selection";
    } else {
    	if ( $query->have_posts() )
    {
    	echo '<div class="row">';
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		?>
    			<div class="col-md-3 popmake-<?php the_ID();?>" data-do-default="" style="cursor: pointer;">
    				<h3 style="text-align: center;"><?php the_title(); ?></h3>
    				<p style="text-align: center;"><?php do_shortcode(the_excerpt()); ?></p>
    			</div>
    	<?php
    	echo '</div>';
    	}
    }
    else
    {
    	echo 'No Results Found';
    }
    }
    ?>

    That may make no difference, but give it a try.

    Anonymous
    #80216

    Yes, you are right. Your corrections was one forgotten quote (that may be important) and changing the double qoutes at the echos to quotes. I think that’s not necessary at that point. But your correction does not solve the Problem.
    Well, the do_shortcode was a test, that also does not solve the problem.

    Trevor
    #80226

    Something is obviously odd with the way the divi does this. It is the line using the_exceprt() that is the issue. Read these two WP Codex pages:

    https://codex.wordpress.org/Function_Reference/get_the_excerpt
    https://developer.wordpress.org/reference/functions/the_excerpt/

    and you will see that shortcodes should actually be removed

    Does it look any different if you replace

    <p style="text-align: center;"><?php the_excerpt(); ?></p>
    

    with

    <p style="text-align: center;"><?php echo get_the_excerpt(); ?></p>
    
    Anonymous
    #80234

    You are right! This is very strange! Even if i use (get_)the_content() the result is always the same. 🙁

    Trevor
    #80253

    In Divi, what element type is the results shortcode in (in the layout)?

Viewing 9 posts - 11 through 19 (of 19 total)