• Is there a way to display search results as an unordered list? On search.php, I’m currently using:

    <h2>Search Results for '<?php echo($s); ?>'</h2>
          <?php if (have_posts()) : ?>
    
          <?php while (have_posts()) : the_post(); ?>
          <!-- begin post container -->
          <div class="post_container">
    
              <a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><br />
    
          </div>
       <!-- End post_container"-->
    
          <?php endwhile; ?>
    <?php endif; ?>

    Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Try this. Obviously will need to be adjusted to suit and you will need to style.

    <h2>Search Results for '<?php echo($s); ?>'</h2>
    <?php if (have_posts()) : ?>
    	<ul>
    		<?php while (have_posts()) : the_post(); ?>
    			<!-- begin post container -->
    			<li class="post_container">
    				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    			</li>
    			<!-- End post container-->
    		<?php endwhile; ?>
    	</ul>
    <?php endif; ?>
    Thread Starter 3Plumes

    (@3plumes)

    That works (why didn’t I think of that?)!! Thank you very much!

    Is there a way to NOT limit the results to the amount of posts stipulated per page? I currently limit posts to 10 per page, but would like to display more results if available

    Thanks!

    replace query_posts(); with –

    $args = array(
        'postsperpage' => -1,
        'numberposts' => -1
    );
    query_posts($args);

    But only use one of the two that are listed, I cannot remember which one is correct off the top of my head.

    Thread Starter 3Plumes

    (@3plumes)

    Sorry, I didn’t use query_posts(); in particular 🙁

    Then how are you getting your posts? Unless it’s on the index page, in which case query_posts(); is run anyway, using the default arguments. If that is the case, you can still use the above code.

    Thread Starter 3Plumes

    (@3plumes)

    Sorry for the slow response. I’m searching from the side bar, and the results are displayed on the search.php template.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Search Results’ is closed to new replies.