Forums

Make sure posts only display from certain category (3 posts)

  1. Whipsmack
    Member
    Posted 3 years ago #

    I'm using a script that displays my blog onto my own custom page. How do I get it to display only from my category called "front page news"? Instead it displays every post from any category.

    Thanks!

    \\*
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <?php the_date('','<h2>','</h2>'); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
    <h3 class="storytitle">" rel="bookmark"><?php the_title(); ?></h3>
    <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> <?/*php the_author() */?><?/*php the_time() */?> <?php edit_post_link(__('Edit This')); ?></div>

    <div class="storycontent">
    <?php the_content(__('(more...)')); ?>
    *\\

  2. scribu
    Member
    Posted 3 years ago #

    At the top of your script add

    <?php query_posts("category_name=front page news'); ?>

  3. bernk
    Member
    Posted 3 years ago #

    Holy that was easy! Thank you : )

    I've been trying to achieve this for the last 30 minutes.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.