[Resolved] Full Width Title On Single Post / Page

Home Forums Support Full Width Title On Single Post / Page

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #179553
    Hftt

    Hi Tom

    The snippet you provided from reply – https://generatepress.com/forums/topic/full-width-title-on-single-post-page/#post-109517 is not working anymore on latest GP version.

    Could you please help me to get back for full width title for single posts and pages?

    Thanks always.

    #179576
    Hftt

    Sorry Tom

    It’s my bad.

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

    It’s OK now. πŸ™‚

    #179598
    Tom
    Lead Developer
    Lead Developer

    Glad you sorted it out πŸ™‚

    #631004
    Perrin

    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?

    #631143
    Tom
    Lead Developer
    Lead Developer

    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.

    #631631
    Perrin

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

    #631723
    Tom
    Lead Developer
    Lead Developer
Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.