treehouse : what would you like to learn today?
Web Design Web Development iOS Development

WordPress: Show ALL Post Titles from a specific Category

  • Hello,

    I'd like to be able to show all the posts from a single category on one page. I'd like to format the returned data so it shows the page title (with permalink) and the date the article was written.

    I'm using:

    query_posts( array ( 'category_name' => 'The Category Name', 'posts_per_page' => -1 ) );

    provided by WordPress.org.

    Unfortunatly, this shows the article name, with permalink and the whole article content. I want to hide the article content.

    Thank you,
    Morgan.
  • This should do the trick... :)

    <ul>
    <?php
    $cat_posts = get_posts('category=10&numberposts=-1');
    foreach($cat_posts as $post) : setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>">
    <?php the_title(); ?>
    </a></li>
    <?php endforeach; ?>
    </ul>
  • Thank you!