Trying to count the total number of paragraphs inside a blog article

I’m pretty sure that is_singular() is going to return false when you are inside the WP loop, since there are more than one posts being looped through. Try is_single() or just look at the post object and examine the post_type attribute.

add_filter( 'the_content', '_some_func', 15 );

function _some_func( $content ) {

    if( __check_paragraph_count_blog( $content ) > 15 )
        $ad_code = "the ad code";
    else
        $ad_code="";

    return prefix_insert_after_paragraph( $ad_code, 12, $content );

}


function __check_paragraph_count_blog( $content ) {
    global $post;
    if ( $post->post_type == 'post' ) {
        $count = substr_count( $content, '</p>' );
        return $count;
    } else {
        return 0;
    }
}

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş