Can you have multiple the_post() objects in your index.php?
-
Hi, new to WordPress/PHP here. In our index.php lives the Loop. In here can we have multiple the_post() objects?
For example can I have the_post() set to only the first 3 posts.
then later again, do the_post() for the rest of my posts.
Is this possible? I would like to do this because the first 3 posts look different and I want to separate them so I can targe them and edit them via CSS.
I have two the_post() here:
<?php get_header(); ?> <div class="container"> <div class="main-content"> <?php query_posts('posts_per_page=10&offset=2'); if ( have_posts() ) : the_post(); ?> <div <?php post_class() ?>> <h2> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a> </h2> <?php the_content(''); ?> </div> <?php endif ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?>> <h2> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a> </h2> <?php the_content(''); ?> </div> <?php endwhile; ?> <?php endif; ?> </div> </div> </div>
- The topic ‘Can you have multiple the_post() objects in your index.php?’ is closed to new replies.