# Larger Lead Paragraph on Posts

> Makes the first paragraph of every blog post slightly larger, a classic magazine touch that draws readers into the article.

- Type: PHP
- Runs: Frontend only
- Category: [Content](https://wpide.com/library/category/content/)
- Tags: typography, paragraph, posts
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/lead-paragraph-style/

## Code

```php
add_filter( 'the_content', function ( $content ) {
    if ( ! is_singular( 'post' ) || ! in_the_loop() || ! is_main_query() ) {
        return $content;
    }

    $result = preg_replace_callback( '/<p(?=[\s>])([^>]*)>/i', function ( $m ) {
        if ( preg_match( '/\sclass=(["\'])/i', $m[1] ) ) {
            return '<p' . preg_replace( '/\sclass=(["\'])/i', ' class=$1wpide-lead ', $m[1], 1 ) . '>';
        }

        return '<p class="wpide-lead"' . $m[1] . '>';
    }, $content, 1 );

    return null === $result ? $content : $result;
}, 20 );

add_action( 'wp_head', function () {
    if ( is_singular( 'post' ) ) {
        echo '<style>.wpide-lead{font-size:1.2em;line-height:1.6;}</style>' . "\n";
    }
} );
```

## Notes

Change the font size in the style rule at the bottom of the snippet.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Larger Lead Paragraph on Posts" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
