• Resolved kdn

    (@kdn)


    Hello.

    I have a problem with listing four boxes with 5 latest links from each category in the index page of my theme. The theme is live at https://videofoto.hiof.no . The problem is that the code I use lists 5 links in total over the four boxes instead of 5 links on each box.

    I use the following code…
    theme/index.php

    <?php 
    
    $boxclass = "list";
    $boxname = "<a class='categoryheading video' href='video/'><!--:en-->Video<!--:--><!--:no-->Video<!--:--> &raquo;</a>";
    $showposts = "5";
    $catnr = "8";
    
    include("module_boxlist.php"); 
    
    $boxclass = "list";
    $boxname = "<a class='categoryheading photo' href='photo/'><!--:en-->Photo<!--:--><!--:no-->Foto<!--:--> &raquo;</a>";
    $showposts = "5";
    $catnr = "5";
    
    include("module_boxlist.php"); 
    
    $boxclass = "list";
    $boxname = "<a class='categoryheading sound' href='sound/'><!--:en-->Sound<!--:--><!--:no-->Lyd<!--:--> &raquo;</a>";
    $showposts = "5";
    $catnr = "7";
    
    include("module_boxlist.php"); 
    
    $boxclass = "list";
    $boxname = "<a class='categoryheading article' href='artikkel/'><!--:en-->Articles<!--:--><!--:no-->Artikkel<!--:--> &raquo;</a>";
    $showposts = "5";
    $catnr = "3";
    
    include("module_boxlist.php"); 
    
    ?>

    theme/module_boxlist.php

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

    Thanks in advance to good ideas on how to fix the problem.

  • The topic ‘How do I print 4 boxes with 5 links on each’ is closed to new replies.