Include header hero to the custom post type page

This might be a question for a paid Dev support, but I figure I would start here.

Is there a way to overwrite this block of code from the class-theme.php via a child theme to expand this elseif to an array that includes custom post types? I am trying to get the existing post template, including the Header/Hero to apply to a custom post type in the listinghive theme.

		} elseif ( is_singular( 'post' ) ) {

			// Add classes.
			$classes = array_merge(
				$classes,
				[
					'post',
					'post--single',
				]
			);

			// Render part.
			$output .= hivetheme()->template->render_part( 'templates/post/single/post-header' );

e.g.

} elseif ( is_singular(array( 'post' ,'cpt1','cpt2') ) {

Thanks

Hi,

It may be easier to use the same hook used by this callback function, and insert the same template part at the top of the post type. Some code will be duplicated in this case but unfortunately there’s no other way to override a list of post types defined in the condition via the child theme or external code snippet.

Hope this helps

1 Like

Thank you. I will see if I can work out how to do that, it helps to have a bit of direction to learn!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.