Can anyone advise the code I need, to have a page, that appears with the title of each category, and then list the posts contained withing the category, then another category with it’s post etc..
So it looks a bit like this…
TITLE OF CATEGORY A
POST 1 CATEGORY A
POST 2 CATEGORY A
TITLE OF CATEGORY B
POST 1 CATEGORY B
POST 2 CATEGORY B
ETC ETC…
Can you advise on how to setup the loop for this? This is my current code – I think I just need to add the Category tag here some where, but I’m a bit stuck…
‚<?php if (have_posts()) : ?>
<?php query_posts(’showposts=20&cat=4,3′); $i = 1; ?>
<?php while (have_posts()) : the_post(); ?>
<!–" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
<small><?php the_time(‚F jS, Y‘) ?> </small>
–>
<h2><?php the_time(‚F Y‘) ?></h2>
<div class="mainNewsBlock">
<?php $values = get_post_custom_values("Image");
if (isset($values[0])) { ?>
" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<img src="<?php echo bloginfo(‚template_url‘); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=35&h=35&zc=1&q=35"
alt="<?php the_title(); ?>" class="left" width="35px" height="35px" />
<?php } ?>
" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?><?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link(‚« Older Entries‘) ?></div>
<div class="alignright"><?php previous_posts_link(‚Newer Entries »‘) ?></div>
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn’t here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
‚
many thanks
(von: adamwork)
Hier noch 4 weitere Ergebnisse dieses Threads:
Re: Page template – list posts by categories :: Reply by adamwork
20. Apr. 2010 (von: adamwork)
Actually - I solved it using this code here: viewtopic.php?f=1&t=14Many thanks Weiterlesen →
Re: Page template – list posts by categories :: Reply by adamwork
20. Apr. 2010 (von: adamwork)
Just a thought - is there any way to set the name of the category NOT to display, if there aren't any posts? Weiterlesen →
Re: Page template – list posts by categories :: Reply by Joern
20. Apr. 2010 (von: Joern)
the code you refer to is actually made for the category bar of arthemia, 5 categories and if there are posts a list of 3 of themIf you do not want to display the category title if there are no…
Re: Page template – list posts by categories :: Reply by adamwork
20. Apr. 2010 (von: adamwork)
nice, thanks joern Weiterlesen →