• hi all

    I Need LAST 10 Topics in the x category in Index.php THe Blocks

    I Need to the main blocks the down of the Index.php

    EX:
    block 1 Display cat 1
    block 2 Display cat 2
    block 3 Display cat 3 …..

    Thank you all

Viewing 4 replies - 1 through 4 (of 4 total)
  • The following will print a list of the last 10 posts for every category:

    foreach( (array) get_all_category_ids() as $cat_id ) :
    	query_posts(array('cat' => $cat_id, 'showposts' => 10));
    	if ( have_posts() ) :
     	?><h2><?php echo get_cat_name($cat_id); ?></h2>
    		<ul>
    		<?php while(have_posts()) : the_post(); ?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endwhile; ?>
    		</ul>
    	<?php
    	endif;
     endforeach;
    Thread Starter mrhak

    (@mrhak)

    Thes code Is Ready

    <?php foreach( (array) get_all_category_ids() as $cat_id ) :
    	query_posts(array('cat' => $cat_id, 'showposts' => 10));
    	if ( have_posts() ) :?><h2><?php echo get_cat_name($cat_id); ?></h2>
    		<ul>
    		<?php while(have_posts()) : the_post(); ?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endwhile; ?>
    		</ul>
    	<?php endif; endforeach; ?>

    thanks friend

    put i need to show onr cat Only

    Plz help me all

    If you need just one category, then do this:

    $cat_id = 2; // "2" is the category id for the category you want
    	query_posts(array('cat' => $cat_id, 'showposts' => 10));
    	if ( have_posts() ) :
     	?><h2><?php echo get_cat_name($cat_id); ?></h2>
    		<ul>
    		<?php while(have_posts()) : the_post(); ?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endwhile; ?>
    		</ul>
    	<?php
    	endif;

    Thread Starter mrhak

    (@mrhak)

    thanks alot

    Dissolved the problem and thanks you, my friend

    Quick question

    Is there an Plugins to this work

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘LAST 10 Topics in the x category’ is closed to new replies.