• Hi all,

    I’m looking to make excerpts for posts that show up on my main page. Previously, I was using the_content() function, but there were many posts that I didn’t manually add a read more link so now I have to resort to the_excerpt() function.

    I already have the codes and the modifications that I need. However, once I put them on, I noticed 2 problems:
    1- All the CSS in the post were gone. They are literally no new lines, no bolding, no blockquote, no nothing. How can I make the formatting to show up again?
    2- For posts that may already have read more links, it doesn’t show up anymore. Rather the post looks like it ends there, no read more links.

    I’m currently resorting to use the_content() function. So, either I have to find solutions to the 2 problems above, or alternatively, I was wondering if there is an option in the_content() function to specify how many words I can display in the excerpt summary?
    I’ve listed my code below FYI.

    function new_excerpt_length($length) {
    	return 150;
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    
    function new_excerpt_more($more) {
            global $post;
    	return '<a>ID) . '"> ...Continue Reading ' . get_the_title('', '', false) . '</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Regards,
    Angela

    [Please post code snippets between backticks or use the code button.]

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘the_excerpt() with CSS’ is closed to new replies.