Reply To: Full Width Title On Single Post / Page

Home Forums Support Full Width Title On Single Post / Page Reply To: Full Width Title On Single Post / Page

Home Forums Support Full Width Title On Single Post / Page Reply To: Full Width Title On Single Post / Page

#109461
Tom
Lead Developer
Lead Developer

Just an update, instead of having to copy the content-page.php and content-single.php files into your child theme, you can use this function to remove the title from pages and single post pages:

add_filter( 'the_title', 'generate_remove_page_titles', 10, 2 );
function generate_remove_page_titles( $title, $id = null )
{
	global $post, $generate_content_filter_completed;
	
	if ( $generate_content_filter_completed ) {
		return $title;
	}
	
	if ( ( is_page() || is_single() ) && in_the_loop() && $title == $post->post_title )
		return '';
		
	return $title;
}

add_filter( 'the_content', 'generate_content_filter_completed' );
function generate_content_filter_completed( $content ) 
{
	global $generate_content_filter_completed;
	$generate_content_filter_completed = true;
	return $content;
}

Then add this CSS:

.page .entry-content,
.single .entry-content {
      margin-top: 0;
}

.page .entry-header,
.single .entry-header {
      display: none;
}

A little bit cleaner 🙂