Title: Posttypes, loop
Last modified: August 20, 2016

---

# Posttypes, loop

 *  [bjornesjo](https://wordpress.org/support/users/bjornesjo/)
 * (@bjornesjo)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/posttypes-loop/)
 * Hello, I would like to know how I can use WordPress loop to display some of my
   posts in a certain way in a div box. For example my recent posts from a certain
   category, as shown.
 * How can I do to add advanced search, using post types or category?
    for example,
   just search for posts (food) where the food takes only 30 minutes to prepare.
 * I guess it’s pretty much to learn, but perhaps you could explain a bit and unless
   otherwise refer to what I should learn.
 *  [picture:](http://imageshack.us/f/840/wordpressforum.jpg/)

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

 *  [Digest WP](https://wordpress.org/support/users/jay-stankiewicz/)
 * (@jay-stankiewicz)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/posttypes-loop/#post-3001260)
 * Hello,
 * Filter WordPress loop like this
 *     ```
       <?php query_posts('category_name=wordpress&showposts=5'); ?>
       <?php while (have_posts()) : the_post(); ?>
               <li><a href="<?php the_permalink(); ?>">
                 <?php the_title(); ?>
                 </a>  </li>
               <?php endwhile; ?>
       ```
   
 * This will help you with the category search
    [http://blog.portal.kharkov.ua/2008/01/13/search-in-category/](http://blog.portal.kharkov.ua/2008/01/13/search-in-category/)
 *     ```
       <form method="get" id="searchform" action="http://www.domain.com/category/myspecialcat/">
       <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id=s>
       <input type="submit" id="searchsubmit" value="Search My Special Cat">
       </form>
       ```
   
 *  Thread Starter [bjornesjo](https://wordpress.org/support/users/bjornesjo/)
 * (@bjornesjo)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/posttypes-loop/#post-3001388)
 * First, thanks for the first answer! 😀
 * Okey, not shore i understod all of it. But is the code for this purpose:
 * lets say i have post with each 5 differant “tags” (30 min, sallads, fastfood,)
   Then i want a search function with radiobuttons.
 * So if I search for pizza and toggle the fastfood radiobutton I only see results
   of pizza who has the tag fastfood.
 * You get what i mean?

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

The topic ‘Posttypes, loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * 2 replies
 * 2 participants
 * Last reply from: [bjornesjo](https://wordpress.org/support/users/bjornesjo/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/posttypes-loop/#post-3001388)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
