blog post set up - override parent theme and remove author from post header and footer

This commit is contained in:
Evan Mullins 2019-03-21 08:21:00 -06:00
parent 7273903965
commit 640a4696be
3 changed files with 166 additions and 1 deletions

View file

@ -232,4 +232,68 @@ function wasmo_update_user( $post_id ) {
delete_transient( 'directory-0' );
}
add_action( 'acf/save_post', 'wasmo_update_user', 5 );
add_action( 'acf/save_post', 'wasmo_update_user', 5 );
//override twentynineteen_entry_footer
function wasmo_entry_footer() {
// Hide author, post date, category and tag text for pages.
if ( 'post' === get_post_type() ) {
// Posted by
//twentynineteen_posted_by();
// Posted on
twentynineteen_posted_on();
/* translators: used between list items, there is a space after the comma. */
$categories_list = get_the_category_list( __( ', ', 'twentynineteen' ) );
if ( $categories_list ) {
printf(
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
'<span class="cat-links">%1$s<span class="screen-reader-text">%2$s</span>%3$s</span>',
twentynineteen_get_icon_svg( 'archive', 16 ),
__( 'Posted in', 'twentynineteen' ),
$categories_list
); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma. */
$tags_list = get_the_tag_list( '', __( ', ', 'twentynineteen' ) );
if ( $tags_list ) {
printf(
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
'<span class="tags-links">%1$s<span class="screen-reader-text">%2$s </span>%3$s</span>',
twentynineteen_get_icon_svg( 'tag', 16 ),
__( 'Tags:', 'twentynineteen' ),
$tags_list
); // WPCS: XSS OK.
}
}
// Comment count.
if ( ! is_singular() ) {
twentynineteen_comment_count();
}
// Edit post link.
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">' . twentynineteen_get_icon_svg( 'edit', 16 ),
'</span>'
);
}

View file

@ -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 wasmo_entry_footer(); ?>
</footer><!-- .entry-footer -->
<?php if ( ! is_singular( 'attachment' ) ) : ?>
<?php get_template_part( 'template-parts/post/author', 'bio' ); ?>
<?php endif; ?>
</article><!-- #post-${ID} -->

View file

@ -0,0 +1,46 @@
<?php
/**
* Displays the post header
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since 1.0.0
*/
$discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<?php if ( ! is_page() ) : ?>
<div class="entry-meta">
<?php //twentynineteen_posted_by(); ?>
<?php twentynineteen_posted_on(); ?>
<span class="comment-count">
<?php
if ( ! empty( $discussion ) ) {
twentynineteen_discussion_avatars_list( $discussion->authors );
}
?>
<?php twentynineteen_comment_count(); ?>
</span>
<?php
// Edit post link.
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">' . twentynineteen_get_icon_svg( 'edit', 16 ),
'</span>'
);
?>
</div><!-- .meta-info -->
<?php endif; ?>