Which template holds what to display when search returns nothing

Question is clear I guess.

Normally, which template is returned when no search results are found. I would say search.php, but my parent theme’s (twenty thirteen) search.php looks like this (slightly edited):

Read More
<?php if ( have_posts() ) : ?>

    <header class="page-header">
        <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentythirteen' ), get_search_query() ); ?></h1>
    </header>

    <?php /* The loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
        <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>

    <?php twentythirteen_paging_nav(); ?>

<?php else : ?>
    <?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>

So, what is the none after content in the third last line? What exactly is fetched from content.php then?

Related posts

1 comment

  1. get_template_part( 'content', 'none' ); will look for:

    1. content-none.php
    2. content.php

    Twenty Thirteen does have content-none.php.

    In general this is organized in such way to support dynamic lookups where first two-part template might or might not exist and fallback to more generic template, if necessary.

Comments are closed.