• Hello gurus,

    I need to display two pages:

    1. A random list of posts that have no comments + its excerpts.

    2. A list of the latest 25 added posts + its excerpts

    Can you please provide some code or refer me to a plugin that i can use to do that .

    Thanks a bunch in advance,
    Gili

Viewing 3 replies - 1 through 3 (of 3 total)
  • 1) show ten most recent excerpts, random order

    <?php
    query_posts('showposts=10&order=RAND');
    if(have_posts()): while(have_posts()): the_post(); ?>
    <?php the_excerpt(); ?>
    <?php endwhile; endif; ?>

    2) show 25 most recent posts

    <?php
    query_posts('showposts=25');
    if(have_posts()): while(have_posts()): the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>

    more info on queries here.

    Thread Starter gili

    (@gili)

    Thanks.

    I didn’t explain myself correctly about the first query i need:

    I need to display only posts which have no comments.

    The question is how to tweak the first query to display only posts with no comments.

    Thanks,
    Gili

    I suppose you could check to see if comments are associated with the post, but that would require a custom function. You’d probably have to query the database first because there’s no existing parameter for checking if there’s comments or not (not that I’m aware of anyway) and use that to add to your query. I don’t know of any plugins that do this, but a forum search comes up with a bunch of stuff. Maybe one of those can help you?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom post listings’ is closed to new replies.