Post list on category page
-
I am trying to get a list of the post within a category which I have done but I want it to only show 3 of the post titles and then have a link for View All under that will link to all of that sub categories posts. The code I have used is below.
Thanks
<?php
$cat_name = get_the_title();
$cat_id = get_cat_id($cat_name);
$categories= get_categories(‘child_of=’.$cat_id);
foreach ($categories as $cat) {
$cat_link = get_category_link($cat->cat_ID);
echo ‘<div class=”region”><h3>‘;
echo $cat->cat_name;
echo ‘</h3>- ‘;
- <a href=”‘;
echo $permalink.'”>’;
echo the_title();
echo ‘
query_posts(‘cat=’.$cat->cat_ID.’&showposts=3′);
while (have_posts()) : the_post(); $permalink = get_permalink($post->ID);
echo ‘‘;
endwhile;
echo ‘‘;
echo ‘</div>’;
}
?> - <a href=”‘;
The topic ‘Post list on category page’ is closed to new replies.