Site logo

Archived topic

Displaying date and author on custom post type

3 replies · Started by James on March 18, 2021

Viewing posts 1–4 of 4

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 Leo,

Thank you - that worked great :)

No problem :)

This archived topic is closed to new replies.