Skip to content

Commit

Permalink
Merge pull request #4 from thoughtis/day-four
Browse files Browse the repository at this point in the history
Day Four
  • Loading branch information
douglas-johnson authored Aug 13, 2019
2 parents 8167d48 + c6505c3 commit 8431874
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 5 deletions.
4 changes: 2 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Footer
* The <footer> element, not the closing of <body> or <html>.
*
* @see template-parts/document-close.php
* @see template-parts/document/document-close.php
* @package Cata
*/

Expand All @@ -30,4 +30,4 @@
</p>
</footer>
<?php
get_template_part( 'template-parts/document', 'close' );
get_template_part( 'template-parts/document/document', 'close' );
25 changes: 25 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,43 @@
*/
function cata_after_setup_theme() {

add_theme_support( 'align-wide' );
add_theme_support( 'automatic-feed-links' );

$html5_options = array(
'caption',
'comment-form',
'comment-list',
'gallery',
'search-form',
// storefront has this, but why?
'widgets',
);

/**
* Theme Supports Editor Styles
*
* @todo add other aspects of block editor support.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/
*/
add_theme_support( 'editor-styles' );

add_theme_support( 'html5', $html5_options );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'title-tag' );

/**
* Theme Supports Woocommerce
*
* @link https://github.com/woocommerce/woocommerce/wiki/Declaring-WooCommerce-support-in-themes
*/
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );

add_theme_support( 'wp-block-styles' );

}
endif;
add_action( 'after_setup_theme', 'cata_after_setup_theme' );
Expand Down
7 changes: 4 additions & 3 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
* Header
* The <header> element, not the opening of <html> or <body>.
*
* @see template-parts/document-open.php
* @see template-parts/document/document-open.php
* @package Cata
*/

get_template_part( 'template-parts/document', 'open' );
get_template_part( 'template-parts/document/document', 'open' );
get_template_part( 'template-parts/skip-link' );
?>
<header class="site__header" id="header" role="banner">
<hgroup>
<h1><?php bloginfo( 'name' ); ?></h1>
<h1>
<a href="<?php echo esc_url( home_url() ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<?php if ( get_bloginfo( 'description' ) ) : ?>
<span><?php bloginfo( 'description', 'display' ); ?></span>
<?php endif; ?>
Expand Down
19 changes: 19 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@
<div class="site__content" id="content">
<section class="site__primary area--content" id="primary">
<main class="site__main" id="main">
<?php
if ( have_posts() ) {
while ( have_posts() ) {

the_post();

if ( is_singular() ) {
get_template_part( 'template-parts/content/content', get_post_type() );
} else {
get_template_part( 'template-parts/preview/preview', get_post_type() );
}
}

the_posts_navigation();

} else {
get_template_part( 'template-parts/content/content', 'none' );
}
?>
</main>
</section>
<?php get_sidebar(); ?>
Expand Down
33 changes: 33 additions & 0 deletions page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Page
*
* @package Cata
*/

get_header();
?>
<div class="site__content" id="content">
<section class="site__primary area--content" id="primary">
<main class="site__main" id="main">
<?php
while ( have_posts() ) :

the_post();

get_template_part( 'template-parts/content/content', get_post_type() );

the_post_navigation();

if ( comments_open() ) :
comments_template();
endif;

endwhile;
?>
</main>
</section>
<?php get_sidebar(); ?>
</div>
<?php
get_footer();
33 changes: 33 additions & 0 deletions single.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Single
*
* @package Cata
*/

get_header();
?>
<div class="site__content" id="content">
<section class="site__primary area--content" id="primary">
<main class="site__main" id="main">
<?php
while ( have_posts() ) :

the_post();

get_template_part( 'template-parts/content/content', get_post_type() );

the_post_navigation();

if ( comments_open() ) :
comments_template();
endif;

endwhile;
?>
</main>
</section>
<?php get_sidebar(); ?>
</div>
<?php
get_footer();
29 changes: 29 additions & 0 deletions template-parts/content/content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Content
* content-*.php templates are used for singular posts.
*
* @see /template-parts/preview/preview-*.php for posts in archives.
* @package Cata
*/

?>
<article <?php post_class(); ?>>
<header>
<h1><?php the_title(); ?></h1>
</header>
<?php if ( has_post_thumbnail() ) : ?>
<figure>
<?php the_post_thumbnail(); ?>
<?php if ( '' !== get_the_post_thumbnail_caption() ) : ?>
<figcaption>
<?php the_post_thumbnail_caption(); ?>
</figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<div>
<?php the_content(); ?>
</div>
<footer></footer>
</article>
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions template-parts/preview/preview.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Preview
* preview-*.php templates are used for posts within archives.
*
* @see /template-parts/content/content-*.php for singular posts.
* @package Cata
*/

?>
<article <?php post_class(); ?>>
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</header>
<?php if ( has_post_thumbnail() ) : ?>
<figure>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php if ( '' !== get_the_post_thumbnail_caption() ) : ?>
<figcaption>
<?php the_post_thumbnail_caption(); ?>
</figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<div>
<?php the_excerpt(); ?>
</div>
<footer></footer>
</article>

0 comments on commit 8431874

Please sign in to comment.