diff options
Diffstat (limited to 'themes/twentynineteen/template-parts/content')
5 files changed, 256 insertions, 0 deletions
diff --git a/themes/twentynineteen/template-parts/content/content-excerpt.php b/themes/twentynineteen/template-parts/content/content-excerpt.php new file mode 100644 index 00000000..98b0761e --- /dev/null +++ b/themes/twentynineteen/template-parts/content/content-excerpt.php @@ -0,0 +1,33 @@ +<?php +/** + * Template part for displaying post archives and search results + * + * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ + * + * @package WordPress + * @subpackage Twenty_Nineteen + * @since 1.0.0 + */ + +?> + +<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + <header class="entry-header"> + <?php + if ( is_sticky() && is_home() && ! is_paged() ) { + printf( '<span class="sticky-post">%s</span>', _x( 'Featured', 'post', 'twentynineteen' ) ); + } + the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); + ?> + </header><!-- .entry-header --> + + <?php twentynineteen_post_thumbnail(); ?> + + <div class="entry-content"> + <?php the_excerpt(); ?> + </div><!-- .entry-content --> + + <footer class="entry-footer"> + <?php twentynineteen_entry_footer(); ?> + </footer><!-- .entry-footer --> +</article><!-- #post-${ID} --> diff --git a/themes/twentynineteen/template-parts/content/content-none.php b/themes/twentynineteen/template-parts/content/content-none.php new file mode 100644 index 00000000..332dd17b --- /dev/null +++ b/themes/twentynineteen/template-parts/content/content-none.php @@ -0,0 +1,53 @@ +<?php +/** + * Template part for displaying a message that posts cannot be found + * + * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ + * + * @package WordPress + * @subpackage Twenty_Nineteen + * @since 1.0.0 + */ + +?> + +<section class="no-results not-found"> + <header class="page-header"> + <h1 class="page-title"><?php _e( 'Nothing Found', 'twentynineteen' ); ?></h1> + </header><!-- .page-header --> + + <div class="page-content"> + <?php + if ( is_home() && current_user_can( 'publish_posts' ) ) : + + printf( + '<p>' . wp_kses( + /* translators: 1: link to WP admin new post page. */ + __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'twentynineteen' ), + array( + 'a' => array( + 'href' => array(), + ), + ) + ) . '</p>', + esc_url( admin_url( 'post-new.php' ) ) + ); + + elseif ( is_search() ) : + ?> + + <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentynineteen' ); ?></p> + <?php + get_search_form(); + + else : + ?> + + <p><?php _e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'twentynineteen' ); ?></p> + <?php + get_search_form(); + + endif; + ?> + </div><!-- .page-content --> +</section><!-- .no-results --> diff --git a/themes/twentynineteen/template-parts/content/content-page.php b/themes/twentynineteen/template-parts/content/content-page.php new file mode 100644 index 00000000..b400a84e --- /dev/null +++ b/themes/twentynineteen/template-parts/content/content-page.php @@ -0,0 +1,56 @@ +<?php +/** + * Template part for displaying page content in page.php + * + * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ + * + * @package WordPress + * @subpackage Twenty_Nineteen + * @since 1.0.0 + */ + +?> + +<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + <?php if ( ! twentynineteen_can_show_post_thumbnail() ) : ?> + <header class="entry-header"> + <?php get_template_part( 'template-parts/header/entry', 'header' ); ?> + </header> + <?php endif; ?> + + <div class="entry-content"> + <?php + the_content(); + + wp_link_pages( + array( + 'before' => '<div class="page-links">' . __( 'Pages:', 'twentynineteen' ), + 'after' => '</div>', + ) + ); + ?> + </div><!-- .entry-content --> + + <?php if ( get_edit_post_link() ) : ?> + <footer class="entry-footer"> + <?php + edit_post_link( + sprintf( + wp_kses( + /* translators: %s: Name of current post. Only visible to screen readers */ + __( 'Edit <span class="screen-reader-text">%s</span>', 'twentynineteen' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ), + '<span class="edit-link">', + '</span>' + ); + ?> + </footer><!-- .entry-footer --> + <?php endif; ?> +</article><!-- #post-<?php the_ID(); ?> --> diff --git a/themes/twentynineteen/template-parts/content/content-single.php b/themes/twentynineteen/template-parts/content/content-single.php new file mode 100644 index 00000000..720a2535 --- /dev/null +++ b/themes/twentynineteen/template-parts/content/content-single.php @@ -0,0 +1,55 @@ +<?php +/** + * Template part for displaying posts + * + * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ + * + * @package WordPress + * @subpackage Twenty_Nineteen + * @since 1.0.0 + */ + +?> + +<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + <?php if ( ! twentynineteen_can_show_post_thumbnail() ) : ?> + <header class="entry-header"> + <?php get_template_part( 'template-parts/header/entry', 'header' ); ?> + </header> + <?php endif; ?> + + <div class="entry-content"> + <?php + the_content( + sprintf( + wp_kses( + /* translators: %s: Name of current post. Only visible to screen readers */ + __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + + wp_link_pages( + array( + 'before' => '<div class="page-links">' . __( 'Pages:', 'twentynineteen' ), + 'after' => '</div>', + ) + ); + ?> + </div><!-- .entry-content --> + + <footer class="entry-footer"> + <?php twentynineteen_entry_footer(); ?> + </footer><!-- .entry-footer --> + + <?php if ( ! is_singular( 'attachment' ) ) : ?> + <?php get_template_part( 'template-parts/post/author', 'bio' ); ?> + <?php endif; ?> + +</article><!-- #post-${ID} --> diff --git a/themes/twentynineteen/template-parts/content/content.php b/themes/twentynineteen/template-parts/content/content.php new file mode 100644 index 00000000..85ec6328 --- /dev/null +++ b/themes/twentynineteen/template-parts/content/content.php @@ -0,0 +1,59 @@ +<?php +/** + * Template part for displaying posts + * + * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ + * + * @package WordPress + * @subpackage Twenty_Nineteen + * @since 1.0.0 + */ + +?> + +<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + <header class="entry-header"> + <?php + if ( is_sticky() && is_home() && ! is_paged() ) { + printf( '<span class="sticky-post">%s</span>', _x( 'Featured', 'post', 'twentynineteen' ) ); + } + if ( is_singular() ) : + the_title( '<h1 class="entry-title">', '</h1>' ); + else : + the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); + endif; + ?> + </header><!-- .entry-header --> + + <?php twentynineteen_post_thumbnail(); ?> + + <div class="entry-content"> + <?php + the_content( + sprintf( + wp_kses( + /* translators: %s: Name of current post. Only visible to screen readers */ + __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentynineteen' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + + wp_link_pages( + array( + 'before' => '<div class="page-links">' . __( 'Pages:', 'twentynineteen' ), + 'after' => '</div>', + ) + ); + ?> + </div><!-- .entry-content --> + + <footer class="entry-footer"> + <?php twentynineteen_entry_footer(); ?> + </footer><!-- .entry-footer --> +</article><!-- #post-${ID} --> |