[Resolved] Search not displaying results.

Home Forums Support [Resolved] Search not displaying results.

Home Forums Support Search not displaying results.

  • This topic has 8 replies, 3 voices, and was last updated 2 years ago by David.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #934464
    Shawn

    Hi.

    I have a strange issue that’s popped up. I installed Relavanssi to see if that fixed it but the issue persists regardless.

    When doing any search it simply shows the blog archive page. No results. No, nothing found.
    I can’t figure out what the problem is.

    My search.php is:

    <?php
    /**
     * The template for displaying Search Results pages.
     *
     * @package GeneratePress
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly.
    }
    
    get_header(); ?>
    
    	<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
    		<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
    			<?php
    			/**
    			 * generate_before_main_content hook.
    			 *
    			 * @since 0.1
    			 */
    			do_action( 'generate_before_main_content' );
    
    			if ( have_posts() ) : ?>
    
    				<header class="page-header">
    					<h1 class="page-title">
    						<?php
    						printf( // WPCS: XSS ok.
    							/* translators: 1: Search query name */
    							__( 'Search Results for: %s', 'generatepress' ),
    							'<span>' . get_search_query() . '</span>'
    						);
    						?>
    					</h1>
    				</header><!-- .page-header -->
    
    				<?php while ( have_posts() ) : the_post();
    
    					get_template_part( 'content', 'search' );
    
    				endwhile;
    
    				/**
    				 * generate_after_loop hook.
    				 *
    				 * @since 2.3
    				 */
    				do_action( 'generate_after_loop' );
    
    				generate_content_nav( 'nav-below' );
    
    			else :
    
    				get_template_part( 'no-results', 'search' );
    
    			endif;
    
    			/**
    			 * generate_after_main_content hook.
    			 *
    			 * @since 0.1
    			 */
    			do_action( 'generate_after_main_content' );
    			?>
    		</main><!-- #main -->
    	</div><!-- #primary -->
    
    	<?php
    	/**
    	 * generate_after_primary_content_area hook.
    	 *
    	 * @since 2.0
    	 */
    	do_action( 'generate_after_primary_content_area' );
    
    	generate_construct_sidebars();
    
    get_footer();
    #934734
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Can you try deactivating your other plugins to check for potential conflicts?

    Is that a custom search.php file? If so, what about it did you change?

    Let me know 🙂

    #934738
    Shawn

    That’s the standard template. Thought perhaps someone might be able to see anything off in there. I’m not great with PHP.

    #934742
    Tom
    Lead Developer
    Lead Developer

    Looks good to me. I’m assuming something is messing with the query, which usually comes from a buggy plugin/server misconfiguration.

    #934758
    Shawn

    I tried disabling before and no change then I cleared cache again and tried again and it seems it’s Elementor yet again causing issues.

    Thanks for the help. I’ll check in with them and see if they’ll help.

    #934773
    Shawn

    While I wait for them to get back to me, would you happen to know how to add placeholder text into the search bar?

    I’m using Snippets so I can add php code.

    #934788
    David
    Staff
    Customer Support
    #934989
    Shawn

    Thank you. Appreciate the help.

    Oh and if anyone else has the search results issue. It was a non-standard post grid. Seems it pulls posts but not search results.
    Changing to the standard grid fixed it.

    Of course then I had the issue of columns being stuck at 50% but an old post on here pointed me at the solution.

    #935043
    David
    Staff
    Customer Support

    Awesome – glad to hear you got it resolved and that we could be of help

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.