Search Result Not Displaying Some Pages
-
I have installed wordpress and created theme but my default wordpress
search function is not displaying some page even though I use same keyword as page title in search box. What might be the cause for it?My Searchform.php code looks like below:
<div class="searchform search" rol="search"> <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/"> <input type="search" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="<?php echo get_theme_mod('search_placeholder', 'Search: Enter Your keywords'); ?> "/> <input type="submit" class="sbutton" alt="Search" value="search"/> </form> </div>
My search.php code looks like below:
<?php dynamic_sidebar('header-link'); ?> <div class="clear" style="clear:both; width:100%; height:auto;"></div> <div class="content"> <?php dynamic_sidebar('mobile-widget'); ?> <div class="mainbar"> <?php the_post(); ?> <div class="article"> <?php if (is_active_sidebar('sidebar-1')) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar('sidebar-1'); ?> </div><!-- #secondary --> <?php endif; ?> <?php if ( have_posts() ) : ?> <h1 class="page-title"> <?php echo get_theme_mod('search_result_text', 'Search Results Found For'); ?> <span><?php the_search_query(); ?></span></h1> <?php while ( have_posts() ) : the_post() ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'evotis'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php echo get_post_meta($post->ID, '_yoast_wpseo_title', true); ?></a></h2> <div class="entry-summary"> <?php echo get_post_meta($post->ID, '_yoast_wpseo_metadesc', true); ?> <div class="h-readmore"> <a href="<?php the_permalink(); ?>"><?php echo get_theme_mod('readmore', 'Lees artikel'); ?></a></div> </div><!-- .entry-summary --> </div><!-- #post-<?php the_ID(); ?> --> <?php endwhile; ?> <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?> <div id="nav-below" class="navigation"> <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'evotis' )) ?></div> <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'evotis' )) ?></div> </div><!-- #nav-below --> <?php } ?> <?php else : ?> <div id="post-0" class="post no-results not-found"> <h2 class="entry-title"><?php _e( 'Nothing Found', 'evotis' ) ?></h2> <div class="entry-content"> <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'evotis' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </div> <?php endif; ?> <?php if (is_active_sidebar('sidebar-2')) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar('sidebar-2'); ?> </div><!-- #secondary --> <?php endif; ?> </div> </div> <?php get_sidebar(); ?> <div class="clr"></div> </div> </div> <?php get_footer(); ?>
- The topic ‘Search Result Not Displaying Some Pages’ is closed to new replies.