Closed thomasplevy closed 4 years ago
It makes sense to me to put the checks into the individual template files instead of in content.php and duplicated in content-cover.php and that is called with a post type parameter, so it could be any other post type also, in a child theme. The part for the author bio should check for post type support, and a filter is always useful. So instead of
if ( is_single() ) {
get_template_part( 'template-parts/entry-author-bio' );
}
the template part should be unconditional and there should be a check inside the author-bio template like
$this_post_type = get_post_type();
if ( post_type_supports( $this_post_type, 'author' ) &&
! in_array( $this_post_type, apply_filters( 'twentytwenty_posttypes_no_author', array( 'page' ) ) ) ) {
if ( is_attachment() || is_single() )
(This is actually code I have in my theme.)
Moved to trac https://core.trac.wordpress.org/ticket/48804
The Problem
Not all custom post types are created equal. Some custom post types are like blog posts where meta information, post author information, and navigation between post types makes sense. Other custom post types behave more like native pages where navigation between pages is undesirable.
This is a pretty generic and blanket statement and it's not always true. Custom post types are custom and the requirement differ greatly depending on the developer creating them.
I am working to add Twenty Twenty theme support for my plugin LifterLMS and I have several custom post types which I'd like to be able to remove author and custom post type navigation for.
Given the fact that custom post types utilize template at
template-parts/content.php
it is currently only possible for me to remove the navigation and author information by using custom CSS.The meta information I am able to disable using the filter
twentytwenty_disallowed_post_types_for_meta_output
.Proposed Solution
I'd like to modify the template in question to either be wrapped in a filter which allow the inclusion of
template-parts/entry-author-bio.php
andtemplate-parts/navigation.php
to be disabled via a filter.For example:
https://github.com/WordPress/twentytwenty/blob/dea9290e7ca3d38b7067c3b7107787db6554249a/template-parts/content.php#L68-L72
Could become:
I'm not sure if it's too late to make a change like this as we're already in RCs on WP Core 5.3 but I wanted to bring this up just in case it's not.
If this does seem like an acceptable addition I'd be more than happy to write and submit the PR but I didn't want to spend time without a blessing from a core contrib or maintainer first.
Thank you for considering this!