• Hi, I’ve seen a lot of people posting their search.php file here when no results are being returned. With the initial setup, blog posts were returned but I disabled them by unchecking the box` because they aren’t a feature of this site. The important content to search are the pages. Any idea what’s happening? Thanks!

    <?php
    /**
     * The template for displaying search results pages.
     *
     * @package Infinity
     */
    
    $tm_finance_heading_image   = get_post_meta( get_the_ID(), "tm_finance_heading_image", true );
    $tm_finance_disable_comment = get_post_meta( get_the_ID(), "tm_finance_disable_comment", true );
    $tm_finance_disable_title   = get_post_meta( get_the_ID(), "tm_finance_disable_title", true );
    $tm_finance_custom_class    = get_post_meta( get_the_ID(), "tm_finance_custom_class", true );
    $tm_finance_layout          = Kirki::get_option( 'tm-finance', 'search_layout' );
    if ( $tm_finance_heading_image ) {
    	$tm_finance_heading_image = get_post_meta( get_the_ID(), "tm_finance_heading_image", true );
    } else {
    	$tm_finance_heading_image = Kirki::get_option( 'tm-finance', 'page_title_bg_image' );
    }
    get_header(); ?>
    <?php if ( $tm_finance_disable_title != 'on' ) { ?>
    	<div class="big-title" style="background-image: url('<?php echo esc_url( $tm_finance_heading_image ); ?>')">
    		<div class="container">
    			<h1 class="entry-title"><?php printf( __( 'Search Results for: %s', 'tm-finance' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
    		</div>
    	</div>
    	<?php if ( function_exists( 'tm_bread_crumb' ) && Kirki::get_option( 'tm-finance', 'breadcrumb_enable' ) == 1 ) { ?>
    		<div class="breadcrumb">
    			<div class="container">
    				<?php echo tm_bread_crumb( array( 'home_label' => __( 'Home', 'tm-finance' ) ) ); ?>
    			</div>
    		</div>
    	<?php } ?>
    <?php } ?>
    	<div class="container">
    		<div class="row">
    			<?php if ( $tm_finance_layout == 'sidebar-content' ) { ?>
    				<?php get_sidebar(); ?>
    			<?php } ?>
    			<?php if ( $tm_finance_layout == 'sidebar-content' || $tm_finance_layout == 'content-sidebar' ) { ?>
    				<?php $class = 'col-md-8'; ?>
    			<?php } else { ?>
    				<?php $class = 'col-md-12'; ?>
    			<?php } ?>
    			<div class="<?php echo esc_attr( $class ); ?>">
    				<main class="content">
    					<?php if ( have_posts() ) : ?>
    						<?php while ( have_posts() ) : the_post(); ?>
    							<?php get_template_part( 'template-parts/content', 'blog' ); ?>
    						<?php endwhile; // end of the loop. ?>
    						<?php tm_finance_paging_nav(); ?>
    					<?php else : ?>
    						<?php get_template_part( 'template-parts/content', 'none' ); ?>
    					<?php endif; ?>
    				</main>
    			</div>
    			<?php if ( $tm_finance_layout == 'content-sidebar' ) { ?>
    				<?php get_sidebar(); ?>
    			<?php } ?>
    		</div>
    	</div>
    <?php get_footer(); ?>
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • @austincomppros

    Did you rebuilt the index in Relevanssi?

    What content is in the current index?

    Thread Starter austincomppros

    (@austincomppros)

    Hi @lukecavanagh

    Yes I built it initially, then erased and rebuilt after making the change. Is that all that needs to be done?

    State of the Index

    Documents in the index: 78
    Terms in the index: 15304
    Highest post ID indexed: 2421

    @austincomppros

    So the 78 documents in the index are just pages then?

    Thread Starter austincomppros

    (@austincomppros)

    @lukecavanagh

    Yes

    Thanks

    Plugin Author Mikko Saari

    (@msaari)

    That template doesn’t have any issues. However, if the Relevanssi index does not contain anything else but pages, the search cannot be powered by Relevanssi if it returns something that isn’t a page.

    You’re talking about the default WP search, right, and not an AJAX dropdown search? Those may well bypass Relevanssi. Can I see your site?

    Thread Starter austincomppros

    (@austincomppros)

    @msaari

    Thanks for your response. I’m not sure I entirely understand what you said though, my goal here is to return relevant results from the 78 pages of my site. There is no blog, and no other areas I need to search.

    https://cprosdev.com/burgbrock/

    Thanks

    Plugin Author Mikko Saari

    (@msaari)

    There are two basic steps you should probably try:

    – Switch to one of the default themes for a moment. Does that make the search work?

    – If not, try disabling other plugins. Does that make the search work?

    This way you can figure out where the problem is, is it a compatibility issue with your theme or another plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Getting blog results, but not page results’ is closed to new replies.