• I know this has been asked a lot but I have done searches and I’ve read through all the answers but I am still unable to get it to work on my site (www.lovesarahblog.com).

    I am trying to make it so that I can style the first post on the first page differently from the rest (I don’t want this to carry over to the older posts on page 2, 3, 4, etc.). Ultimately I am trying to make the first post full width while having the others + the sidebar display underneath.

    I know it has to do with the loop but I am not sure how to change it.

    If anyone could point me in the right direction, that would be wonderful. Here is my loop as it stands right now:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                             <?php if( $wp_query->current_post == 0 && !is_paged() ) : ?>
                                 <?php get_template_part('content'); ?>
                             <?php else : ?>
                             <?php if(get_theme_mod('sp_home_layout') == 'grid' || get_theme_mod('sp_home_layout') == 'grid-full') : ?>
                                  <?php get_template_part('content', 'grid'); ?>
                             <?php elseif(get_theme_mod('sp_home_layout') == 'list' || get_theme_mod('sp_home_layout') == 'list-full') : ?>
                                  <?php get_template_part('content', 'list'); ?>
                             <?php else : ?>
                                  <?php get_template_part('content'); ?>
                             <?php endif; ?>
                             <?php endif; ?>
                        <?php endwhile; ?>

    Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to style first post differently’ is closed to new replies.