I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs. My custom post is post link and taxonomy name is new categories My Code is below
<?php
/* template name: Posts by Category! */
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?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&posts_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 ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
query_posts
in your code, it's very very bad for performance and triggers lots of problems. Can you edit your question to include a question though? It's not clear what you asked, there are no questions in your question