Site logo

Archived topic

Full Width Title On Single Post / Page

22 replies · Started by Hftt on May 9, 2015

Viewing posts 16–23 of 23

Sorry Tom

It's my bad.

I forgot to add title output using generate_after_header hook at functions.php.

It's OK now. :)

Glad you sorted it out :)

Hey Tom :)

Trying to get this done, but no matter what I do, both titles either appear or disappear completely. :/

Here's the PHP added (includes both sets of PHP):

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;
}

add_action('generate_after_header','generate_add_title_below_header');
function generate_add_title_below_header()
{ 
	// If we're not on a page, don't do anything
	if ( is_page() || is_single() ) {
	?>
	<div class="page-header-content generate-page-header generate-content-header page-header-title">
		<div class="inside-page-header-container inside-content-header grid-container grid-parent">
			<header class="entry-header">
				<h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1>
			</header><!-- .entry-header -->
		</div>
	</div>
	<?php }
}

And here's the CSS added:

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

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

Any ideas?

It might be worth checking out GPP 1.7 (currently a release candidate): https://generatepress.com/gp-premium-1-7/

It allows you to create a "Page Hero" which can include the title of the current page. Adding it will automatically remove the default title.

Worked swimmingly. You're a hell of a guy, Tom. A hell of a guy.

Glad I could help! :)

Worked! thanks

This archived topic is closed to new replies.