Skip to content

Commit

Permalink
Moved page templates to new directory
Browse files Browse the repository at this point in the history
  • Loading branch information
peiche committed Feb 17, 2016
1 parent 15c3a34 commit bff0b7e
Show file tree
Hide file tree
Showing 21 changed files with 102 additions and 60 deletions.
10 changes: 5 additions & 5 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

get_header(); ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php get_template_part( 'inc/cover', '404' ); ?>

<?php get_template_part( 'template-parts/cover', '404' ); ?>

<section class="error-404 not-found">
<div class="page-content">

<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'cover' ); ?></p>

</div><!-- .page-content -->
</section><!-- .error-404 -->

Expand Down
8 changes: 4 additions & 4 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

get_header(); ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php get_template_part( 'inc/cover', 'archive' ); ?>
<?php get_template_part( 'template-parts/cover', 'archive' ); ?>

<?php if ( have_posts() ) : ?>

Expand All @@ -27,7 +27,7 @@
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content' ); ?>
<?php get_template_part( 'template-parts/content', 'summary' ); ?>

<?php endwhile; ?>
</div>
Expand All @@ -36,7 +36,7 @@

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>

Expand Down
8 changes: 4 additions & 4 deletions author.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@

get_header(); ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php get_template_part( 'inc/cover', 'author' ); ?>
<?php get_template_part( 'template-parts/cover', 'author' ); ?>

<?php if ( have_posts() ) : ?>

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content' ); ?>
<?php get_template_part( 'template-parts/content', 'summary' ); ?>

<?php endwhile; ?>

<?php the_posts_navigation(); ?>

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>

Expand Down
11 changes: 11 additions & 0 deletions inc/jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function cover_jetpack_setup() {
*/
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'render' => 'cover_infinite_scroll_render',
'footer' => false,
) );

Expand Down Expand Up @@ -47,6 +48,16 @@ function cover_jetpack_setup() {
}
add_action( 'after_setup_theme', 'cover_jetpack_setup' );

/**
* Custom render function for Infinite Scroll.
*/
function cover_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', 'summary' );
}
}

/**
* Handle `footer_widgets` argument
*
Expand Down
8 changes: 4 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

get_header(); ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php
if ( cover_has_featured_posts( 1 ) ) {
get_template_part( 'inc/cover', 'featured' );
get_template_part( 'template-parts/cover', 'featured' );
}
?>

Expand All @@ -28,15 +28,15 @@
<div id="posts" class="<?php echo $list_style; ?> <?php if ( 'grid' == $list_style && $number_of_columns > 1 ) { echo 'card-' . $number_of_columns; } ?>">
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content' ); ?>
<?php get_template_part( 'template-parts/content', 'summary' ); ?>

<?php endwhile; ?>
</div>
<?php the_posts_navigation(); ?>

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>

Expand Down
8 changes: 4 additions & 4 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php get_template_part( 'inc/cover', 'post' ); ?>
<?php get_template_part( 'template-parts/cover', 'page' ); ?>

<?php get_template_part( 'content', 'page' ); ?>
<?php get_template_part( 'template-parts/content', 'page' ); ?>

<?php get_template_part( 'inc/comments' ); ?>
<?php get_template_part( 'template-parts/comments' ); ?>

</main><!-- #main -->
</div><!-- #primary -->
Expand Down
8 changes: 4 additions & 4 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

get_header(); ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php get_template_part( 'inc/cover', 'archive' ); ?>
<?php get_template_part( 'template-parts/cover', 'archive' ); ?>

<?php if ( have_posts() ) : ?>

Expand All @@ -25,7 +25,7 @@
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content' ); ?>
<?php get_template_part( 'template-parts/content', 'summary' ); ?>

<?php endwhile; ?>
</div>
Expand All @@ -34,7 +34,7 @@

<?php else : ?>

<?php get_template_part( 'content', 'none' ); ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>

Expand Down
16 changes: 9 additions & 7 deletions single.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@

get_header(); // Call header inside the loop to get author info. ?>

<?php get_template_part( 'inc/wrapper', 'top' ); ?>
<?php get_template_part( 'template-parts/wrapper', 'top' ); ?>

<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">

<?php get_template_part( 'inc/cover', 'post' ); ?>
<?php
get_template_part( 'template-parts/cover', 'single' );

<?php get_template_part( 'content', 'single' ); ?>
get_template_part( 'template-parts/content', 'single' );

<?php get_template_part( 'inc/comments' ); ?>
get_template_part( 'template-parts/comments' );

<?php if ( 'thread' != get_post_type() ) { ?>
<?php cover_post_nav(); ?>
<?php } ?>
if ( 'thread' != get_post_type() ) {
cover_post_nav();
}
?>

</main><!-- #main -->
</div><!-- #primary -->
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions content-page.php → template-parts/content-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'cover' ),
'after' => '</div>',
'link_before' => '<span class="button small">',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
Expand Down
4 changes: 3 additions & 1 deletion content-single.php → template-parts/content-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'cover' ),
'after' => '</div>',
'link_before' => '<span class="button small">',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
Expand Down Expand Up @@ -50,7 +52,7 @@
<?php edit_post_link( __( '<i class="fa fa-pencil"></i> Edit', 'cover' ), '<div><span class="edit-link">', '</span></div>' ); ?>

<?php if ( 'thread' != get_post_type() ) { ?>
<?php get_template_part( 'inc/author-bio' ); ?>
<?php get_template_part( 'template-parts/author-bio' ); ?>
<?php } ?>

</footer><!-- .entry-meta -->
Expand Down
17 changes: 2 additions & 15 deletions content.php → template-parts/content-summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@
<?php } ?>

<header class="entry-header">

<!--
<?php
$format = get_post_format();
if ( current_theme_supports( 'post-formats', $format ) ) {
printf( '<span class="entry-format">%1$s<a href="%2$s"><i class="fa fa-fw fa-post-format-%3$s"></i><span class="entry-format-text">%4$s</span></a></span>',
sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'cover' ) ),
esc_url( get_post_format_link( $format ) ),
$format,
get_post_format_string( $format )
);
}
?>
-->

<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<div class="entry-meta">
<?php cover_posted_on(); ?>
Expand All @@ -63,6 +48,8 @@
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'cover' ),
'after' => '</div>',
'link_before' => '<span class="button small">',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-summary -->
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion inc/cover-author.php → template-parts/cover-author.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
<div class="cover">
<div class="cover-background<?php if ( '' != $img ) { ?> darken" style="background-image: url('<?php echo $img; ?>');<?php } ?>"></div>
<header class="cover-header">
<?php get_template_part( 'inc/author-bio' ); ?>
<?php get_template_part( 'template-parts/author-bio' ); ?>
</header>
</div>
File renamed without changes.
48 changes: 48 additions & 0 deletions template-parts/cover-page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Header for posts and pages
*
* @package Cover
*/

?>

<?php
$class = '';
$height = 0;

if ( '' != get_the_post_thumbnail() ) {
$img_arr = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
$img = $img_arr[0];
$width = $img_arr[1];
$height = $img_arr[2];
$class = ' featured-image';
if ( $height > 1 && $height <= 600 ) {
$class = $class . ' hero';
} else if ( $height > 600 ) {
$class = $class . ' full';
}
}
?>

<div class="cover<?php echo $class; ?>">
<div class="cover-background<?php if ( '' != $class ) { ?>" style="background-image: url('<?php echo $img; ?>');<?php } ?>" role="img"></div>

<header class="cover-header">

<?php if ( $post->post_parent ) {
$parent_permalink = get_permalink( $post->post_parent );
$parent_title = get_the_title( $post->post_parent );
?>
<h2 class="cover-subtitle"><a href="<?php echo $parent_permalink; ?>"><i class="fa fa-angle-left"></i> <?php echo $parent_title; ?></a></h2>
<?php } ?>

<h1 class="cover-title"><?php the_title(); ?></h1>
</header>

<?php if ( $height > 600 ) { ?>
<a href="#post-<?php the_ID(); ?>" class="cover-background-jump"><i class="fa fa-fw fa-angle-down"></i></a>
<a href="<?php echo $img; ?>" class="cover-background-link swipebox" target="_blank"><i class="fa fa-fw fa-expand"></i></a>
<?php } ?>

</div>
12 changes: 1 addition & 11 deletions inc/cover-post.php → template-parts/cover-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,9 @@
<div class="cover-background<?php if ( '' != $class ) { ?>" style="background-image: url('<?php echo $img; ?>');<?php } ?>" role="img"></div>

<header class="cover-header">

<?php if ( is_page() ) { ?>
<?php if ( $post->post_parent ) {
$parent_permalink = get_permalink( $post->post_parent );
$parent_title = get_the_title( $post->post_parent );
?>
<h2 class="cover-subtitle"><a href="<?php echo $parent_permalink; ?>"><i class="fa fa-angle-left"></i> <?php echo $parent_title; ?></a></h2>
<?php } ?>
<?php } ?>

<h1 class="cover-title"><?php the_title(); ?></h1>

<?php if ( is_single() && 'thread' != get_post_type() ) { ?>
<?php if ( 'thread' != get_post_type() ) { ?>
<div class="entry-meta">
<?php cover_posted_on(); ?>
</div>
Expand Down
File renamed without changes.

0 comments on commit bff0b7e

Please sign in to comment.