Forums

image categories off by 1 (1 post)

  1. occasio
    Member
    Posted 1 year ago #

    I have the following code in my theme

    <?php
    $display_categories = array(3,12,5,6,7);
    foreach ($display_categories as $category) { 
    
    	query_posts("showposts=1&cat=$category");
    	$wp_query->is_category = false;
    	$wp_query->is_archive = false;
    	$wp_query->is_home = true;
    ?>
    		<div id="idk">
    			<a href="<?php echo get_category_link($category);?>">
    				<img src="<?php bloginfo('template_directory'); ?>/images/<?php foreach((get_the_category()) as $cat) { echo $cat->category_nicename; }?>banner.png"></a>
    				<div id="midcolumnleft">
    					<?php
    					query_posts("showposts=1&cat=$category");
    					$wp_query->is_category = false;
    					$wp_query->is_archive = false;
    					$wp_query->is_home = true;
    					?>

    For some reason each category image is posted one section lower than it should be. The links however are correct.

Topic Closed

This topic has been closed to new replies.

About this Topic