wp/wp-content/themes/twentytwelve/content.php
changeset 8 c7c34916027a
parent 7 cf61fcea0001
child 9 177826044cd9
equal deleted inserted replaced
7:cf61fcea0001 8:c7c34916027a
     1 <?php
       
     2 /**
       
     3  * The default template for displaying content
       
     4  *
       
     5  * Used for both single and index/archive/search.
       
     6  *
       
     7  * @package WordPress
       
     8  * @subpackage Twenty_Twelve
       
     9  * @since Twenty Twelve 1.0
       
    10  */
       
    11 ?>
       
    12 
       
    13 	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       
    14 		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
       
    15 		<div class="featured-post">
       
    16 			<?php _e( 'Featured post', 'twentytwelve' ); ?>
       
    17 		</div>
       
    18 		<?php endif; ?>
       
    19 		<header class="entry-header">
       
    20 			<?php
       
    21 			if ( ! post_password_required() && ! is_attachment() ) :
       
    22 				the_post_thumbnail();
       
    23 			endif;
       
    24 			?>
       
    25 
       
    26 			<?php if ( is_single() ) : ?>
       
    27 			<h1 class="entry-title"><?php the_title(); ?></h1>
       
    28 			<?php else : ?>
       
    29 			<h1 class="entry-title">
       
    30 				<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
       
    31 			</h1>
       
    32 			<?php endif; // is_single() ?>
       
    33 			<?php if ( comments_open() ) : ?>
       
    34 				<div class="comments-link">
       
    35 					<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
       
    36 				</div><!-- .comments-link -->
       
    37 			<?php endif; // comments_open() ?>
       
    38 		</header><!-- .entry-header -->
       
    39 
       
    40 		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
       
    41 		<div class="entry-summary">
       
    42 			<?php the_excerpt(); ?>
       
    43 		</div><!-- .entry-summary -->
       
    44 		<?php else : ?>
       
    45 		<div class="entry-content">
       
    46 			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
       
    47 			<?php
       
    48 			wp_link_pages(
       
    49 				array(
       
    50 					'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ),
       
    51 					'after'  => '</div>',
       
    52 				)
       
    53 			);
       
    54 ?>
       
    55 		</div><!-- .entry-content -->
       
    56 		<?php endif; ?>
       
    57 
       
    58 		<footer class="entry-meta">
       
    59 			<?php twentytwelve_entry_meta(); ?>
       
    60 			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
       
    61 			<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
       
    62 				<div class="author-info">
       
    63 					<div class="author-avatar">
       
    64 						<?php
       
    65 						/** This filter is documented in author.php */
       
    66 						$author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 );
       
    67 						echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
       
    68 						?>
       
    69 					</div><!-- .author-avatar -->
       
    70 					<div class="author-description">
       
    71 						<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
       
    72 						<p><?php the_author_meta( 'description' ); ?></p>
       
    73 						<div class="author-link">
       
    74 							<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
       
    75 								<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?>
       
    76 							</a>
       
    77 						</div><!-- .author-link	-->
       
    78 					</div><!-- .author-description -->
       
    79 				</div><!-- .author-info -->
       
    80 			<?php endif; ?>
       
    81 		</footer><!-- .entry-meta -->
       
    82 	</article><!-- #post -->