web/wp-content/themes/twentytwelve/index.php
changeset 204 09a1c134465b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
       
     1 <?php
       
     2 /**
       
     3  * The main template file.
       
     4  *
       
     5  * This is the most generic template file in a WordPress theme
       
     6  * and one of the two required files for a theme (the other being style.css).
       
     7  * It is used to display a page when nothing more specific matches a query.
       
     8  * For example, it puts together the home page when no home.php file exists.
       
     9  *
       
    10  * Learn more: http://codex.wordpress.org/Template_Hierarchy
       
    11  *
       
    12  * @package WordPress
       
    13  * @subpackage Twenty_Twelve
       
    14  * @since Twenty Twelve 1.0
       
    15  */
       
    16 
       
    17 get_header(); ?>
       
    18 
       
    19 	<div id="primary" class="site-content">
       
    20 		<div id="content" role="main">
       
    21 		<?php if ( have_posts() ) : ?>
       
    22 
       
    23 			<?php /* Start the Loop */ ?>
       
    24 			<?php while ( have_posts() ) : the_post(); ?>
       
    25 				<?php get_template_part( 'content', get_post_format() ); ?>
       
    26 			<?php endwhile; ?>
       
    27 
       
    28 			<?php twentytwelve_content_nav( 'nav-below' ); ?>
       
    29 
       
    30 		<?php else : ?>
       
    31 
       
    32 			<article id="post-0" class="post no-results not-found">
       
    33 
       
    34 			<?php if ( current_user_can( 'edit_posts' ) ) :
       
    35 				// Show a different message to a logged-in user who can add posts.
       
    36 			?>
       
    37 				<header class="entry-header">
       
    38 					<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
       
    39 				</header>
       
    40 
       
    41 				<div class="entry-content">
       
    42 					<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
       
    43 				</div><!-- .entry-content -->
       
    44 
       
    45 			<?php else :
       
    46 				// Show the default message to everyone else.
       
    47 			?>
       
    48 				<header class="entry-header">
       
    49 					<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
       
    50 				</header>
       
    51 
       
    52 				<div class="entry-content">
       
    53 					<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
       
    54 					<?php get_search_form(); ?>
       
    55 				</div><!-- .entry-content -->
       
    56 			<?php endif; // end current_user_can() check ?>
       
    57 
       
    58 			</article><!-- #post-0 -->
       
    59 
       
    60 		<?php endif; // end have_posts() check ?>
       
    61 
       
    62 		</div><!-- #content -->
       
    63 	</div><!-- #primary -->
       
    64 
       
    65 <?php get_sidebar(); ?>
       
    66 <?php get_footer(); ?>