• So I just started using the Zinnias Lite theme. I went into the CSS and changed the

    <?php the_content(); ?>

    to

    <?php the_excerpt); ?>

    so that entire posts would not show on the home page. Now I cannot figure out how to add a “read more” or “continue reading” button to the bottom of the excerpt so that it is easy to just continue reading.

    I tried editing the post and inserting a read more tag and that did not work it just appeared as white blank space.

    here is a link to my website: http://www.SmartAndSimplistic.com

    I cannot find any answers, I do not want to start over with a new phone.

Viewing 1 replies (of 1 total)
  • One thing you should not be doing is making changes to any of the theme files directly. The next time you have to update the theme because of bug fixes, feature enhancements, security patches, or changes to the WordPress core, then your changes will be lost. The recommended procedure for making changes is to create a child theme and then make your change to a copy of whatever file you want to modify.

    So, if you look at the developer documentation for the_excerpt() function, down in the User Contributed Notes section there is this note. So what you can do is in your child theme’s function.php file is to add something like this:

    /**
     * Filter the "read more" excerpt string link to the post.
     *
     * @param string $more "Read more" excerpt string.
     * @return string (Maybe) modified "read more" excerpt string.
     */
    function wpdocs_excerpt_more( $more ) {
        return sprintf( '<a class="read-more" href="%1$s">%2$s</a>',
            get_permalink( get_the_ID() ),
            __( 'Read More', 'textdomain' )
        );
    }
    add_filter( 'excerpt_more', 'wpdocs_excerpt_more' );

    This should replace the […] with a clickable link that says Read More. Then to style it into something that looks like a button, add some CSS to your child theme’s style.css file for the .read-more class.

Viewing 1 replies (of 1 total)
  • The topic ‘Zinnias Lite Post Excerpt Problem’ is closed to new replies.