Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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'
share|improve this question
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 Mar 7 '13 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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