Support » Themes and Templates » Display "read more" only if no excerpt

  • egilarntzen



    I have this code in my content.php:

    <?php if ( is_search() || is_home() ) : // Only display Excerpts for Search and home ?>
    		<div class="entry-summary">
    			<?php the_excerpt();
    echo "<a href='".get_permalink()."' class='read-more'>Les mer</a>"; ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
            	<?php the_content(); ?>
            </div><!-- .entry-content -->
    		<?php endif; ?>

    But even if I don’t have excerpt in two of these posts, it still displays the “read more”.

    Any ideas?
    This is a child theme for twenty twelve by the way.

    Any help would be most appreciated.

  • The topic ‘Display "read more" only if no excerpt’ is closed to new replies.