Home › Forums › Support › Full Width Title On Single Post / Page › Reply To: Full Width Title On Single Post / Page
May 10, 2015 at 8:49 am
#107005
Tom
Lead Developer
Lead Developer
For sure ๐
1. Install a child theme: http://generatepress.com/api/themes/generatepress_child.zip
2. Add the following code to your child theme’s functions.php file:
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;
}
3. Then add this CSS to your child theme’s style.css file:
.page .entry-content,
.single .entry-content {
margin-top: 0;
}
.page .entry-header,
.single .entry-header {
display: none;
}
4. Now, you can re-add the title above using a function like this to your child theme’s functions.php file:
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 }
}