• Hi everyone, would so appreciate some help.

    I’m using the Intuition them which I think is great apart from it pumps out very limited search results. I have swapped over to a few themes to see whether it was theme-specific and it is. I’ve written lots of posts with specific keywords but when i search for them, they don’t show.

    I think the search.php only looks at the title and excerpts and I hardly use excerpts at all. here is thecode for search.php. any idea how I can ge it to actually search through the content and not just the excerpts?

    Thanks

    <?php get_header(); ?>
    
    <div id="pagetitle" class="pagetitle">
    	<div class="container">
    		<h1 class="pagetitle-title"><?php _e('Search Results for', 'cpotheme') ?> '<?php echo the_search_query();?>'</h1>
    	</div>
    </div>
    
    <div id="main" class="main">
    	<div class="container">
    		<section id="content" class="content <?php cpotheme_sidebar_position(); ?>">
    			<div class="widget_search">
    				<form role="search" method="get" id="search-form" class="search-form" action="<?php echo home_url('/'); ?>">
    					<input type="text" value="<?php if(isset($_GET['s'])) echo $_GET['s']; ?>" name="s" id="s" />
    					<input type="submit" id="search-submit" value="<?php _e('Search', 'cpotheme'); ?>" />
    				</form>
    			</div>
    			<?php if(have_posts()): while(have_posts()): the_post(); ?>
    
    			<article class="search" id="post-<?php the_ID(); ?>"> 
    
    				<h2 class="search-title">
    					<a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Go to %s', 'cpotheme'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
    				</h2>
    
    				<div class="search-byline">
    					<?php the_permalink(); ?>
    				</div>
    				<div class="search-content">
    					<?php the_excerpt(); ?>
    				</div>
    			</article>
    
    			<?php endwhile; ?>
    			<div class="pagination">
    				<div class="pagination-prev">
    					<?php previous_posts_link(__('Newer', 'cpotheme')); ?>
    				</div>
    				<div class="pagination-next">
    					<?php next_posts_link(__('Older', 'cpotheme')); ?>
    				</div>
    			</div>
    			<?php endif; ?>
    		</section>
    		<?php get_sidebar(); ?>
    	</div>
    </div>
    
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • Hi
    WordPress will be searching the content but your simply not seeing the full post content on your results page.

    If you wish to see the whole post you will need to change:

    the_excerpt(); to the_content();

    in the file you pasted above. Please note.. this will mean you cannot update the theme in future. So you may wish to read about child themes: https://codex.www.ads-software.com/Child_Themes and implement the change there.

    I also recommend looking at a plugin like https://www.ads-software.com/plugins/search-everything/ which will improve the accuracy of results and if I remember correctly also changes the_excerpt(); to show the relevant part of the page/post based on your search term.

Viewing 1 replies (of 1 total)
  • The topic ‘Search results only searching excerpts’ is closed to new replies.