WordPress.org

Ready to get started?Download WordPress

Forums

Iconic One
[resolved] How to Show Full Content on Sticky Post (3 posts)

  1. ringmastersw
    Member
    Posted 9 months ago #

    Hello

    I am using the Iconic One theme and I would like to make the sticky post on the Home page show the full content and not just an excerpt. However I would like to keep the rest of the posts on the Home page as excerpts.

    I have found other users' posts looking to do similar/the same thing, but since they are all talking about different themes I am having a hard time following with my limited knowledge. The code that is posted below is where I am at right now. The non-sticky posts show up fine, but the sticky one has the excerpt and what looks like the beginning of the content (1st paragraph) but not all of it.
    Screenshot

    How can I make it so the sticky posts show the full content and regular posts (non-sticky) show the excerpts? Where should I edit the code?

    WordPress Version: 3.7
    Theme Version: 1.2.3
    Note I am editing a child theme of Iconic

    Original Code (from content.php)

    <?php if ( is_search() || is_home() || is_category() || is_tag() ) : // Display Excerpts for Search, home, category and tag pages ?>
    	<div class="entry-summary">
    		<!-- Iconic One home page thumbnail with custom excerpt -->
    		<div class="excerpt-thumb">
    			<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>
    				<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themonic' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
    					<?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?>
    				</a>
    			<?php endif;?>
    		</div>
    		<?php the_excerpt(); ?>
    	</div><!-- .entry-summary -->
    <?php else : ?>
    	<div class="entry-content">
    		<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'themonic' ) ); ?>
    		<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'themonic' ), 'after' => '</div>' ) ); ?>
    	</div><!-- .entry-content -->
    <?php endif; ?>

    Edited Code

    <?php if ( is_search() || is_home() || is_category() || is_tag() ) : // Display Excerpts for Search, home, category and tag pages ?>
    	<div class="entry-summary">
    		<!-- Iconic One home page thumbnail with custom excerpt -->
    		<div class="excerpt-thumb">
    			<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>
    				<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themonic' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
    					<?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?>
    				</a>
    			<?php endif;?>
    		</div>
    		<?php if ( is_sticky() )
    			the_content();
    		else;
    			the_excerpt();
    		?>
    	</div><!-- .entry-summary -->
    <?php else : ?>
    	<div class="entry-content">
    		<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'themonic' ) ); ?>
    		<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'themonic' ), 'after' => '</div>' ) ); ?>
    	</div><!-- .entry-content -->
    <?php endif; ?>
  2. ringmastersw
    Member
    Posted 9 months ago #

    UPDATE:
    Figured out the reason why only part of the full post was showing up. It was due to my having a <!--more--> tag in the code from before we were going to show the full post.

    Now I have the non-sticky posts showing normally and the sticky posts with both the full post and the excerpt.
    Screenshot

  3. ringmastersw
    Member
    Posted 9 months ago #

    Fixed it! Edited the content.php file in my child theme of Iconic One - changed this:

    <?php if ( is_sticky() )
    			the_content();
    		else;
    			the_excerpt();
    		?>

    to this:

    <?php if ( is_sticky() )
    			the_content();
    		else
    			the_excerpt();
    		?>

    And it removed the extra excerpt from the full content sticky post.

Reply

You must log in to post.

About this Theme

About this Topic