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://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 |
|
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><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p> |
|
47 </div><!-- .entry-content --> |
|
48 |
|
49 <?php |
|
50 else : |
|
51 // Show the default message to everyone else. |
|
52 ?> |
|
53 <header class="entry-header"> |
|
54 <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1> |
|
55 </header> |
|
56 |
|
57 <div class="entry-content"> |
|
58 <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p> |
|
59 <?php get_search_form(); ?> |
|
60 </div><!-- .entry-content --> |
|
61 <?php endif; // end current_user_can() check ?> |
|
62 |
|
63 </article><!-- #post-0 --> |
|
64 |
|
65 <?php endif; // end have_posts() check ?> |
|
66 |
|
67 </div><!-- #content --> |
|
68 </div><!-- #primary --> |
|
69 |
|
70 <?php get_sidebar(); ?> |
|
71 <?php get_footer(); ?> |
|