WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So currently I have this working for 'search' ie: if I do www.domain.com/search/query, it returns everything it finds on the word 'query'. I would like to utilize that loop/template I created within that search.php but change it to posts. Then query a specific post category if possible ie: www.domain.com/posts/category1

I'm think it all stems off changing

<?php get_template_part('loop', 'search'); ?>

Fairly new to wordpress so any help or suggestions is greatly appreciated!

share|improve this question
How do you "have this working for 'search'"? Are you using a plugin? You should include the contents of loop-search.php in your question too. – mrwweb Jun 6 '12 at 21:14
up vote 0 down vote accepted

You can customise the loop query to get results based on a search term - with $s being the search term;

<?php // Post Query
's'      => $s, 
<?php query_posts($args); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.