[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
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 * @link https://developer.wordpress.org/themes/basics/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 24 // Start the Loop. 25 while ( have_posts() ) : 26 the_post(); 27 ?> 28 <?php get_template_part( 'content', get_post_format() ); ?> 29 <?php endwhile; ?> 30 31 <?php twentytwelve_content_nav( 'nav-below' ); ?> 32 33 <?php else : ?> 34 35 <article id="post-0" class="post no-results not-found"> 36 37 <?php 38 if ( current_user_can( 'edit_posts' ) ) : 39 // Show a different message to a logged-in user who can add posts. 40 ?> 41 <header class="entry-header"> 42 <h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1> 43 </header> 44 45 <div class="entry-content"> 46 <p> 47 <?php 48 /* translators: %s: Post editor URL. */ 49 printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); 50 ?> 51 </p> 52 </div><!-- .entry-content --> 53 54 <?php 55 else : 56 // Show the default message to everyone else. 57 ?> 58 <header class="entry-header"> 59 <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1> 60 </header> 61 62 <div class="entry-content"> 63 <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p> 64 <?php get_search_form(); ?> 65 </div><!-- .entry-content --> 66 <?php endif; // End current_user_can() check. ?> 67 68 </article><!-- #post-0 --> 69 70 <?php endif; // End have_posts() check. ?> 71 72 </div><!-- #content --> 73 </div><!-- #primary --> 74 75 <?php get_sidebar(); ?> 76 <?php get_footer(); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |