Applying different formatting to just the first post on the first page
-
I’ve read through plenty of threads on the forum, and there doesn’t seem to be a precise answer to my question/issue:
What’s the best way to apply different formatting to just the first post on the first page, without using wp_query, offset, and multiple loops?
I’ve seen ways to apply additional styling to just the first post on the first page (https://www.ads-software.com/support/topic/293739?replies=5), but not to change the code/format of the post.
What I mean is:
<?php if (have_posts()) : ?> <?php $post = $posts[0]; ?> <?php while (have_posts()) : the_post(); ?> // what would the code be for "if is the first post" so it shows: <h1>The first post on the main index page</h1> <?php the_title(); ?> <?php the_excerpt(); ?> // what would the code be for "if is every other post thereafter the first on the first page" so it shows: <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php endwhile; ?> <!-- page nav --> <?php endif; ?>
Thanks in advance, guys.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Applying different formatting to just the first post on the first page’ is closed to new replies.