• kdn

    (@kdn)


    Hello.

    I am trying to make a custom loop for what I would call a “box”. The reason behind creating this box is that it is used to display a list of post from different categories. Wherever I want to have the box included I use the following code:

    <?php
    $boxclass = "list";
    $boxname = "Sound";
    $showposts = "5";
    $catnr = "3";
    include("module_boxlist.php");
    ?>

    The content of module_boxlisted.php is:

    <div class="<?php echo $boxclass; ?>">
    					<h4><?php echo $boxname; ?></h4>
    					<ul>
    						<?php query_posts('showposts=' . $showposts . '&cat=' . $catnr );
    	  						while (have_posts()) : the_post();
    						?>
    
    						<li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
        					<?php endwhile; ?>
    					</ul>
    </div>

    Anyone have an idea about why the loop fails?

  • The topic ‘Category loop problems’ is closed to new replies.