Make GeneratePress Default To Full-Width, No-Title On All Elementor Pages

The title says it all, but it's a mouthful, isn't it? Tom Usborne created a function for GeneratePress theme users to allow us to automatically make all Elementor pages full width, with no title.

Of course, we can already do that manually, on a page-by-page basis, but some users would prefer to have the theme default to full width, no title, and change it as needed for individual pages, rather than the other way around.

It's a simple process to get working.

Simply paste the following function code into your theme's functions.php file, or better yet, use the excellent free Code Snippets plugin to manage all your custom functions.

If you are unsure how to add the function, GeneratePress has a helpful how-to page for that.

The Function Code

You can grab the function code from here, and I'd recommend you do that, in case it ever changes in the future. But just in case, it ever disappears from there, it's documented below as well.

add_action( 'template_redirect','tu_add_elementor_filter', 999 );
function tu_add_elementor_filter() {
	if ( in_array( 'elementor-page elementor-page-' . get_the_ID(), get_body_class() ) ) {
		add_filter( 'body_class', 'tu_add_elementor_classes' );
		add_filter( 'generate_show_title','__return_false' );
	}
}

function tu_add_elementor_classes( $classes ) {
	$classes[] = 'full-width-content';
	return $classes;
}

Donna F. Cavalier is a woman of many interests, both online and off. A WordPress enthusiast since 2004, she fell in love with both GeneratePress theme and Elementor page builder. Together, they help create stunning WordPress websites. Hence, this site was born. She also has many other WordPress and web design related sites, such as WPLot.us (a WordPress maintenance service), CavalierWebDesign.com, DonnaFontenot.com, and others. She is also an author, with one novel, The Grave Blogger, and 2 children’s books Petal Pals: Swamp Adventure and Petal Pals: Off to Amarillo published, with others to be published soon. Finally, she is also a Southeast Louisiana Wedding Officiant, owner of Happy Life Weddings.

Share With Friends

Leave a Comment