Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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
$args=array(
's'      => $s, 
);
?>
<?php query_posts($args); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
share|improve this answer

Your Answer

 
discard

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.