How To Style Excerpts Separately?

  • Anonymous

    #9544

    The excerpt and the post content use the same css commands .entry-content p,. I would like to know how I can separate the excerpts from the post content in order to use a different font size for both of them.

    Thanks in advance.

    EDIT: I resolved the problem.

    I added the following to my functions.php (in child theme) file to create a separate class for excerpts.

    add_filter( "the_excerpt", "add_class_to_excerpt" );
    function add_class_to_excerpt( $excerpt ) {
    return str_replace('<p', '<p class="excerpt"', $excerpt);
    }

    CSS Class:

    .excerpt {
    font-size: 14px;
    }

    Source: http://bavotasan.com/2012/add-class-to-all-excerpts-in-wordpress/

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.