Created
February 28, 2017 06:31
-
-
Save dabrattoli/c5aa7a1dfdfb7aecd1071579336b43dd to your computer and use it in GitHub Desktop.
Developer Workshop - Create Your Own Movie Review Website - Archive Template Files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The main template file | |
* | |
* This is the most generic template file in a WordPress theme | |
* and one of the two required files for a theme (the other being style.css). | |
* It is used to display a page when nothing more specific matches a query. | |
* E.g., it puts together the home page when no home.php file exists. | |
* | |
* @link https://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package WordPress | |
* @subpackage Twenty_Seventeen | |
* @since 1.0 | |
* @version 1.0 | |
*/ | |
get_header(); ?> | |
<div class="wrap"> | |
<?php if ( is_home() && ! is_front_page() ) : ?> | |
<header class="page-header"> | |
<h1 class="page-title"><?php single_post_title(); ?></h1> | |
</header> | |
<?php else : ?> | |
<header class="page-header"> | |
<h2 class="page-title"><?php _e( 'Reviews', 'twentyseventeen' ); ?></h2> | |
</header> | |
<?php endif; ?> | |
<div id="primary" class="content-area"> | |
<main id="main" class="site-main" role="main"> | |
<?php | |
if ( have_posts() ) : | |
/* Start the Loop */ | |
while ( have_posts() ) : the_post(); | |
/* | |
* Include the Post-Format-specific template for the content. | |
* If you want to override this in a child theme, then include a file | |
* called content-___.php (where ___ is the Post Format name) and that will be used instead. | |
*/ | |
get_template_part( 'template-parts/custom/content', 'review-list' ); | |
endwhile; | |
the_posts_pagination( array( | |
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>', | |
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ), | |
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>', | |
) ); | |
else : | |
get_template_part( 'template-parts/post/content', 'none' ); | |
endif; | |
?> | |
</main><!-- #main --> | |
</div><!-- #primary --> | |
<?php get_sidebar(); ?> | |
</div><!-- .wrap --> | |
<?php get_footer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template part for displaying posts | |
* | |
* @link https://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package WordPress | |
* @subpackage Twenty_Seventeen | |
* @since 1.0 | |
* @version 1.0 | |
*/ | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<?php | |
if ( is_sticky() && is_home() ) : | |
echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) ); | |
endif; | |
?> | |
<header class="entry-header"> | |
<?php | |
if ( 'post' === get_post_type() ) : | |
echo '<div class="entry-meta">'; | |
if ( is_single() ) : | |
twentyseventeen_posted_on(); | |
else : | |
echo twentyseventeen_time_link(); | |
twentyseventeen_edit_link(); | |
endif; | |
echo '</div><!-- .entry-meta -->'; | |
endif; | |
if ( is_single() ) { | |
the_title( '<h1 class="entry-title">', '</h1>' ); | |
} else { | |
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); | |
} | |
?> | |
</header><!-- .entry-header --> | |
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?> | |
<div class="post-thumbnail"> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?> | |
</a> | |
</div><!-- .post-thumbnail --> | |
<?php endif; ?> | |
<div class="entry-content"> | |
<?php | |
/* translators: %s: Name of current post */ | |
the_content( sprintf( | |
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), | |
get_the_title() | |
) ); | |
wp_link_pages( array( | |
'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ), | |
'after' => '</div>', | |
'link_before' => '<span class="page-number">', | |
'link_after' => '</span>', | |
) ); | |
?> | |
</div><!-- .entry-content --> | |
<?php if ( is_single() ) : ?> | |
<?php twentyseventeen_entry_footer(); ?> | |
<?php endif; ?> | |
</article><!-- #post-## --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment