Add post in a catetory automaticly to a page? (2 posts)

  1. Sn3ipen
    Posted 8 years ago #

    I am totaly new to WordPress but need some answers

    Is there any way to make posts in a specific category and or child category end up in a page automaticly?

  2. tsguitar
    Posted 8 years ago #

    Do you mean that you want to write a Page that will show only posts from a certain category, like a "Writing" category page? query_posts is what you'd want to use. Give this a shot:

    Template Name: Test
    <?php query_posts('category_name=yourcategoryname');
    while (have_posts()) : the_post();
      // do whatever you want
    <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>

    Paste that into a PHP file, let's say test.php, and upload it to your theme folder. Then create a Page (don't type anything in the page itself) and select Test from the Page Template list. Visit the page and see what happens. Here's some reading:

    Is there a reason you can't just use the specific category page instead of creating a new page? It seems like you're creating a page to display something that you can already do automatically with WordPress. Let me know how I'm misunderstanding.

Topic Closed

This topic has been closed to new replies.

About this Topic