Archived topic
Displaying date and author on custom post type
3 replies · Started by James on March 18, 2021
Hi there,
I have created a Custom Post Type and the date and author are currently not displayed on posts (they are shown on the blog).
I've copied the option_generate_blog_settings snippet and tweaked it for the CPT:
add_filter( 'option_generate_blog_settings', 'gp_reviews_single_page_settings' );
function gp_reviews_single_page_settings( $options ) {
if ( is_singular( 'reviews' ) ) {
$options['single_post_image'] = false;
$options['single_date'] = true;
$options['single_author'] = true;
}
return $options;
}
However, the date and author are still not displayed. Changing single_post_image between true and false does have an effect on single posts with that post type, but not the date or author.
Is there something I can change in the filter? The code is added to the functions.php file in a child theme.
Many thanks.
Hi James,
Can you try this filter?
https://docs.generatepress.com/article/generate_entry_meta_post_types/
Let me know :)
Hi Leo,
Thank you - that worked great :)
No problem :)