WordPress.org

Forums

Showing category in posts query (1 post)

  1. Tibor Paulsch
    Member
    Posted 6 years ago #

    I use this query in my sidebar to get the last 8 posts from a category (and it's subcategories):

    <?php $result = "<ul class='latest'>";
    $catposts = get_posts('category=19&amp;numberposts=8');
    foreach ($catposts as $single):
    $result .= '<li><a href=';
    $result.=get_permalink($single->ID).'>'.$single->post_title.'</a></li>';
    endforeach;
    $result .= "</ul>";
    echo $result; ?>

    Now i'm stuck in finding a way to show each results' category name and post date.

    Any tips?

    Thx in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.