Can't remove breadcrumbs via hook (HTML5)

Community Forums Forums General Discussion Can't remove breadcrumbs via hook (HTML5)

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  Stefsull 9 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #91036

    Stefsull
    Participant
    Post count: 47

    I’m trying to reposition my breadcrumbs (to put them in a responsive wrapper beneath the header). I’ve got it working in that they’re showing up in the new wrapper. What I can’t figure out is why they’re not being removed from the original position. (Yes, I have two sets!) Here’s my code:

    //* Move the breadcrumbs up into their own parent holder
    remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
    add_action( 'genesis_after_header', 'modified_genesis_do_breadcrumbs' );
    function modified_genesis_do_breadcrumbs() {
    	if ( is_page() )
    		return; // don't do breadcrumbs on pages ?>
    
    	<div class="breadcrumb__parent">
    	<?php genesis_breadcrumb();?>
    	</div>
    
    <?php }

    What happens is, I do achieve the breadcrumbs in the breadcrumb_parent… I do not achieve the remove_action. Thoughts on why this could be? (I’m using Genesis HTML5.) I can’t give a URL because I’m working on

    #91046

    Stefsull
    Participant
    Post count: 47

    As is sometimes the case, you work on something forever, finally ask a question — then figure it out yourself. I’m leaving the answer here for another lost soul (and my guess as to WHY this is the answer).

    Apparently, though the remove_action might work nicely when you’re using the add_action to reposition them. But using it to remove them and replace them with a custom function doesn’t — IF YOU’VE CHECKED THE BOX IN THE ADMIN DIRECTING IT WHERE TO PUT THE BREADCRUMBS. #facepalm Forgot that was there.

    I unchecked the admin box and magically, my second set of breadcrumbs disappeared.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.