Support » Fixing WordPress » Post Excerpts

  • I currently use Post Excerpts for the Front Page but would like the FIRST post on the Front Page to be a Full Post but when it’s replaced with a New Post, the New Post becomes a Full Post and the previous, an Excerpt.

    Is there a way to do this automatically so I can still add the Excerpt but only have it show on the Front Page when a new Post is Published?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter SB

    (@sghb)

    Would this work:

    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; $c=0;?>
    <?php while (have_posts()) : the_post(); ?>
    
    <?php $c++;
    if( !$paged && $c == 1) :?>
    <h1>The first post on the main index page</h1>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    
    <?php else :?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endif;?>
    
    <?php endwhile; ?>
    
    // page nav
    <?php endif; ?>

    And how would I implement it here:

    <header class="entry-header"><h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wplook' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1></header>
    			<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    				<div class="entry-content"><?php the_excerpt(); ?></div><!-- .entry-summary -->
    			<?php elseif ( is_single() ): ?>
    				<div class="entry-content">
    				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'wplook' ) ); ?>
    				<?php wp_link_pages( array( 'before' => '<div class="clear"></div><div class="page-link"><span>' . __( 'Pages:', 'wplook' ) . '</span>', 'after' => '</div>' ) ); ?>
    				<?php if ( is_single() && ($wpl_share_buttons_post == '' || $wpl_share_buttons_post == 'Display') ) : wplook_social_buttons(); endif; ?>
    			<!-- .entry-content -->
    			<div class="clear"></div>
    				<div class="entry-utility">
    					<?php // display or not the Categories below the posts
    					if ($wpl_display_categories_post == '' || $wpl_display_categories_post == 'Display') { ?>
    						<div class="category"><b><?php _e('Category:', 'wplook'); ?></b> <?php the_category(', ') ?><div class="end"></div></div>
    					<?php } // end ?>  
    
    					<?php if ( get_the_tag_list( '', ', ' ) ) { ?><div class="tag"> <b><?php _e('Tag:', 'wplook'); ?></b> <?php echo get_the_tag_list('',', ',''); ?>
    						<div class="end"></div></div>
    					<?php } ?>
    				</div><div class="clear"></div></div>
    			<?php else : ?>
    			<div class="entry-content">
    				<?php
    					if($post->post_excerpt == ''){
    						the_content( __( '...Continue reading <span class="meta-nav">&rarr;</span>', 'wplook' ) );
    						wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'wplook' ) . '</span>', 'after' => '</div>' ) );
    					} else {
    							the_excerpt();
    						}
    				?>
    			<div class="clear"></div>
    			</div><!-- .entry-content -->
    			<?php endif; ?>

    TIA

    Thread Starter SB

    (@sghb)

    Help Please.

    🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post Excerpts’ is closed to new replies.