WordPress.org

Support

Support » Plugins and Hacks » How can i show only post from 1 catagorie in the sidebar?

How can i show only post from 1 catagorie in the sidebar?

  • 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…

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?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/

    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;
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can i show only post from 1 catagorie in the sidebar?’ is closed to new replies.
Skip to toolbar