Hi, I’m making a custom module that will allow me to place the breadcrumbs in a different location than the default crumbs, and at the same time remove the default crumbs (using php, not css). So when the BB module is dragged onto the page, it will remove the default and relocate it where the BB module is located.
I’m using Genesis with Yoast SEO, so manually adding the crumbs to the frontend.php file using:
if (function_exists('yoast_breadcrumb' ) ) {
yoast_breadcrumb('<div class="breadcrumb" itemprop="breadcrumb">','</div>');
}
The remove action is not working, but will work if I add it to my functions.php file. I’ve tried using after theme setup and a couple other hooks with no success.
I believe the remove_action call isn’t working because that action has probably already fired by the time the module has rendered. Modules render in the content and the action is called genesis_after_header, so my guess is that action is called before any content is rendered. Your best bet is to include it in your functions.php file.
Thanks for your reply! I thought that might be the case.
Can you recommend a way to check if this specific module is active on a page, so I can add it to my functions.php and use a conditional for pages with this module loaded?
That’s possible, but would require some custom PHP to accomplish. You can start by pulling all of the builder data for the current post using…
if ( FLBuilderModel::is_builder_enabled() ) {
global $post;
$data = get_post_meta( $post->ID, '_fl_builder_data', true );
// print_r( $data ); This will show you what's contained in the $data array.
// Loop through the data and look for your module.
}
From there you’ll need to loop through the data and check to see if your module is active.