for example show this type
Category 1
post1
post 2
post3
category 2
post 1
post 2
Category 3
post1
post 2
post3
code :
<?php
// get all the categories from the database
$cats = get_categories();
// loop through the categries
foreach ($cats as $cat) {
// setup the cateogory ID
$cat_id= $cat->term_id;
// Make a header for the cateogry
echo "<h2>".$cat->name."</h2>";
// create a custom wordpress query
query_posts("cat=$cat_id&post_per_page=100");
// start the wordpress loop!
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php // create our link now that the post is setup ?>
<a href="<?php the_permalink();?>"><?php the_title(); ?></a>
<?php echo '<hr/>'; ?>
<?php endwhile; endif;
// done our wordpress loop. Will start again for each category ?>
<?php } // done the foreach statement ?>
this method is very helpful for show all post category by . thanks to sharing your knowledge
ReplyDeletethanks
Deletehello. if i want to display a particular category then what to do
ReplyDelete$cat_id= 10; 10 is category id
ReplyDeleteecho $cat->name ;
query_posts("cat=$cat_id&post_per_page=100");
if (have_posts()) : while (have_posts()) : the_post();
the_title();
endwhile; endif; ?>
how to dispaly category wise post on a particular page with specific category post .
ReplyDeletehello. if i want to display a particular category post on a particular page than what to do.
ReplyDeleteare you want
DeleteCategory1
p1
p2
p3
ans
$cat_id= 10; 10 is category id
echo $cat->name ;
query_posts("cat=$cat_id&post_per_page=100");
if (have_posts()) : while (have_posts()) : the_post();
the_title();
endwhile; endif; ?>
Hi. if i want to display a particular category then what to do.thanks for sharing
ReplyDeleteWordpress Developer
How can i post this code in my theme?
ReplyDeletei have 2 category first is mobile phone and id is 4 and second is smart phone category id is 5 when i want list post according category its show only uncategoryied category post
ReplyDeletealso its show onlt category id1 post its not show cat id4 and cat id5 please replay me
i want to display my post as
ReplyDeleteCategory 1 Category 2
Category 3 Category 4
Category 1 Category 2
....
Thanks for sharing Useful information....
ReplyDeleteEcommerce Website Design and Development Company In Bangalore|Magento Ecommerce website Development company
Hi there would you mind stating which blog platform you're working with?
ReplyDeleteI'm planning to start my own blog in the near future
but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and style seems different
then most blogs and I'm looking for something unique.
P.S Apologies for being off-topic but I had to ask!