Posttypes, loop (3 posts)

  1. bjornesjo
    Posted 3 years ago #

    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.


  2. Digest WP
    Posted 3 years ago #


    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

    <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">
  3. bjornesjo
    Posted 3 years ago #

    First, thanks for the first answer! :D

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic