• Currently i have this code running my posts page, showing categories 3,4,5,6 and if there is a multiple of 2 it prints the div.example, its working perfectly.

    <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		$postcnt = 0; query_posts("showposts=99&cat=3,4,5,6");
    		if (have_posts()) { ?>
    			<div class="example">
    		<ul class="content_cols">
    			<?php
    			while ( have_posts() ) : the_post(); $postcnt++;?>
    
    				<li>
    
    <a href="<?php the_permalink() ?>" title="View more details of <?php the_title(); ?>"><img src="http://jezthompson.co.uk/ransom_note/wp-content/uploads/<?php echo $data[ 'event_image' ]; ?>" alt = "work image"/></a> 
    
    <h3><?php the_title(); ?></h3>
    
    <div class="clearFix"><!--x--></div>
    </li>
    
    				<?php if($postcnt % 2 == 0) { ?>
    					</ul>
    					<?php if($postcnt % 6 == 0) { ?>
    
    					<div class="line"></div>
    					<div class="clearFix"><!--x--></div>
    						</div>
    
    						<div class="example">
    					<?php } ?>
    					<ul class="content_cols">
    				<?php } ?>
    			<?php
    			endwhile; ?>
    			</ul>
    			<div class="clearFix"><!--x--></div>
    			</div>
    			<?php
    			} ?>

    However i need the archive.php to act the same way and i’m not sure how…

    I know its something to do with this..

    <?php while (have_posts()) : the_post(); $data = get_post_meta( $post->ID, 'key', true );?>

    When you click on a category and it just shows the posts from that particular one, i need that page to work like the above posts page really.

    Any ideas…?

    Many thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter jezthomp

    (@jezthomp)

    I’ve managed to get it partly working here..

    <div class="example">
    		<ul class="content_cols">
    
    		<?php while (have_posts()) : the_post();     $data = get_post_meta( $post->ID, 'key', true );?>
    
    		<li class="cat<?php $category = get_the_category(); echo $category[0]->cat_ID;?>">
    
    <h3><?php the_title(); ?></h3>
    
    <div class="clearFix"><!--x--></div>
    		</li>
    
    						<?php if($postcnt % 2 == 0) { ?>
    						<?php if($postcnt % 6 == 0) { ?>
    					</ul>
    					<div class="line"></div>
    					<div class="clearFix"><!--x--></div>
    						</div>
    
    						<div class="example">
    					<?php } ?>
    					<ul class="content_cols">
    				<?php } ?>
    			<?php
    			endwhile; ?>
    			</ul>
    			<div class="clearFix"><!--x--></div>
    			</div>
    
    	<?php else :
    
    		if ( is_category() ) { // If this is a category archive
    			printf("<h2>Sorry, but there aren't any posts in the %s category yet.</h2>", single_cat_title('',false));
    		} 
    
    	endif;
    ?>

    However, its only putting one li in each .example div, rather than putting 6 li into one div.
    Stuck now 🙁

Viewing 1 replies (of 1 total)

The topic ‘Archieve.php same as my post page?’ is closed to new replies.