Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?php
/**
* Modify theme to support Beaver Builder better.
*
* - Set the theme layout to full width.
* - Remove the `site-inner` markup.
* - Remove the `content-sidebar-wrap` markup.
* - Remove the entry header and page/ post title.
*
* @package Generico\Core
*
* @since 1.0.0
*/
namespace Generico\Core;
add_action( 'wp_loaded', __NAMESPACE__ . '\\add_beaver_builder_support' );
/**
* Register support for our `add_theme_support` function early so our theme can see it.
*
* @since 1.0.0
*/
function add_beaver_builder_support() {
if ( ! current_theme_supports( 'generico-beaver-builder' ) ) {
return;
}
add_action( 'genesis_meta', __NAMESPACE__ . '\\beaver_builder_tweaks' );
/**
* Hook our filters and actions after `genesis_meta`.
*
* @since 1.0.0
*/
function beaver_builder_tweaks() {
// Force full width content layout.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Remove all of the extra markup around <main>.
add_filter( 'genesis_markup_site-inner', '__return_null' );
add_filter( 'genesis_markup_content-sidebar-wrap', '__return_null' );
// Remove all post titles.
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment