WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.