WordPress.org

Forums

How can i show only post from 1 catagorie in the sidebar? (3 posts)

  1. Eddie_WP
    Member
    Posted 9 years ago #

    In myne sidebar i have the code:

    <?php BX_get_recent_posts($p,10); ?>

    This show a list from the latest 10 post. But i want not al post show, but only post from the catagorie hardware. How can i do that?

    I hope someone can help me...

  2. doubledubs
    Member
    Posted 9 years ago #

    <?php $posts = get_posts( "category=2&numberposts=1" ); ?>

    I haven't tried it, but that should work.

    Along with the codex, here's a great resource:

    http://guff.szub.net/wordpress/template-tags/

  3. debi
    Member
    Posted 9 years ago #

    This is what you want, I think..

    <?php
    $temp_query = $wp_query;
    $catposts = 'cat=CAT_ID&paged=1&order=DESC';
    query_posts($catposts);
    while (have_posts()) : the_post();
    echo '<a href="';
    the_permalink();
    echo '">';
    the_title();
    echo "";
    endwhile;
    $wp_query = $temp_query;
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.