WordPress.org

Ready to get started?Download WordPress

Forums

Last Post (1 post)

  1. EvandrOliveira
    Member
    Posted 7 years ago #

    Hello...

    Hey I created a category called "O projeto" ok.
    Then in the index page I want to show the posts from this category... then I used the following code..

    <div id = "bio_prev">
    <?php $my_query = new WP_Query('category_name=O Projeto'); ?>
    <?php if($my_query->have_posts()) : ?><?php while($my_query->have_posts()) : $my_query->the_post(); ?>
    <div class = "post1">
    <h3 class = "projeto">"> <?php the_title(); ?></h3>
    <div class = "entry1">
    <?php the_excerpt(); ?>
    </div>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>

    Everything Is ok.. But in this way the index page shows all post from this category but I just wnat to show ONE post from this category.... How Can I do that ?

    Thank you for attention...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags