tags:

views:

44

answers:

1

Hey

I have 3 boxes that i have at the bottom of my home page, i want to display in each of them a wordpress post.

Each of these posts will be under a category special1, special2, special3, how do i do this?

I have tried

<div class="special_box">
        <?php query_posts('tag=special3');?>
    </div>

But this does not work

Any ideas? I tried this, but it replaced all of my other content with just the post, which is not what i want

This is outside the wordpress loop:

<?php 

$special1 = query_posts('category_name=special1'); ?>

This is inside:

<div class="special_box">
        <?php echo $special1 ;?>
    </div>
+2  A: 

This new query will show the latest post from a category and can be used more than once on a page/post (with php excecution enabled) and within the standard WP loop:

<?php $my_query = new WP_Query('category_name=special1&showposts=1'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php the_title(); ?></a><br /><?php the_content(); ?><?php endwhile; ?>

Function Reference/WP Query « WordPress Codex

songdogtech
Thank you, works perfectly :)