How can I add in a post the words "No content available" if nothing is ritten

If there is no text added, i want to get "No content available" automated in my template. I want to get for a specific Post Type, Seriale.

How can I make that?

In the template i have this

    if (is_search()) 
        the_content(__('Read the rest of this entry &raquo;')); ?>
    if (is_page() or is_single()) 
            'before' => '<p><strong>Pages:</strong> ', 
            'after' => '</p>', 'next_or_number' => 'number'
  • Have you searched before asking? Also, what this code has to do with "No content"? What template is this? :::: Please, don't answer in the comments, update your Question: edit
    – brasofilo
    Commented Mar 7, 2013 at 12:27

1 Answer 1

add_filter( 'the_content', 'check_empty_postcontent', 0, 99 ); // filter post content
add_filter( 'the_excerpt', 'check_empty_postcontent', 0, 99 ); // filter excerpt content

function check_empty_postcontent( $content ) {

    global $post;

    $post_type = get_post_type( $post->ID );

    return ( empty( $content ) && 'seriale' === strtolower( $post_type ) ) ?
        'No content available' : $content;


There are a lot of articles about that in the web.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.