WordPress WordPress Theme Development Adding a Blog to a WordPress Theme Coding the Blog Homepage

Jake Ford
Jake Ford
9,230 Points

Is there not an easier way to add a read more button than I did?

I spent a little too much time on this, but finally got it working!

                    <h2><?php echo strip_tags( get_the_excerpt() ); ?>

                    <?php if( str_word_count( get_the_excerpt() ) > 16 ) : ?>

                    <a style="font-size: .6em;" href="<?php the_permalink(); ?>">READ MORE</a>

                    <?php endif; ?>

Although, I thought the logic could have been like this:

<?php if( get_the_excerpt() ) : ?>

Wouldn't this if statement check to see if there is an excerpt for the post and then display read more? I thought this way would work..