Remove .lead class From First Paragraph of Wordpress Post

Leave a Comment
You may came across situation like first paragraph each post or page has added lead class automatically, after you publishing each post or pages in your wordpress site.

If it looks ugly on your site, then you want to remove that.  Follow this simple steps to remove.

Please comment out following PHP scripts in your functions.php file of your wordpress theme.
function first_paragraph($content){
    global $post;

    // if we're on the homepage, don't add the lead class to the first paragraph of text
    if( is_page_template( 'page-homepage.php' ) )
        return $content;
    else
        return preg_replace('/<p([^>]+)?>/', '<p$1 class="lead">', $content, 1);
}
add_filter('the_content', 'first_paragraph');

If you are using Wp bootstrap i.e. wordpress starter theme from http://320press.com. To remove lead class from first paragraph of the wordpress post or page. Comment out following lines in the functions.php file.
function wp_bootstrap_first_paragraph( $content ){
    global $post;

    // if we're on the homepage, don't add the lead class to the first paragraph of text
    if( is_page_template( 'page-homepage.php' ) )
        return $content;
    else
        return preg_replace('/<p([^>]+)?>/', '<p$1 class="lead">', $content, 1);
}
add_filter( 'the_content', 'wp_bootstrap_first_paragraph' );

0 comments:

Post a comment