0

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!

  • 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
0

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(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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