Support » Fixing WordPress » Searching only posts and not pages!

  • I need help with my site:

    The search box at the top is only searching posts and not pages.
    I want the search box to search for pages, for I don’t have nor will not be creating posts.

    I have no plugins.

    Here’s my search.php:

    <?php get_header(); ?>
    <div id="content" class="clearfix">
      <div id="main" class="col-sm-8 clearfix" role="main">
        <div id="home-main" class="home-main home">
            <div class="page-catheader cat-catheader">
                <h4 class="cat-title">
    				<?php printf( __( 'Search : %s', 'redpro' ), '<span>' . get_search_query() . '</span>' ); ?>
          <?php if (function_exists('mywiki_custom_breadcrumbs')) mywiki_custom_breadcrumbs(); ?>
          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
          <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
                <div class="cat-hadding">
                     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title();?></a>
    	$title 	= get_the_title();
    	$keys= explode(" ",$s);
    	$title 	= preg_replace('/('.implode('|', $keys) .')/iu',
    		'<strong class="search-excerpt"></strong>',
                <p class="meta post-meta-entry"><?php mywiki_entry_meta(); ?></p>
                <p class="meta post-meta-entry"><?php the_tags(); ?></p>
            <!-- end article header -->
            <section class="post_content">
              <?php the_post_thumbnail( 'wpbs-featured' ); ?>
              <?php the_excerpt(); ?>
            <!-- end article section -->
          <!-- end article -->
          <?php endwhile; ?>
    	  <?php endif; ?>
          <nav class="mywiki-nav">
                    <span class="mywiki-nav-previous"><?php previous_posts_link(); ?></span>
                    <span class="mywiki-nav-next"><?php next_posts_link(); ?></span>
      <!-- end #main -->
      <?php get_sidebar(); ?>
    <!-- end #content -->
    <?php get_footer(); ?>

  • The topic ‘Searching only posts and not pages!’ is closed to new replies.