Closed alleknalle closed 3 months ago
When adding support for generating breadcrumb trails within the loop, that code was added. It is more-or-less required for the gutenberg block to function properly. I can revisit it, but in general, calling from within the loop now tries to generate the breadcrumb trail for the current post object in the loop.
That sounds logical, but I think then if the current post object in the loop is the front page, then it should still display the unlinked home template.
For now I've hooked in bcn_before_fill
and bcn_after_fill
to set $wp_query->in_the_loop
to false and then back to true again.
I just pushed a fix to this. To ensure you get the homepage template while calling within the loop, make sure the $force
parameter is set to false (default value except for within the Breadcrumb Trail block).
Hi there,
When using Breadcrumb NavXT on my website with a custom 'home' breadcrumb template, I noticed that my 'unlinked' home breadcrumb template is not being used on the homepage. It uses the 'page' breadcrumb template.
When debugging I found out that this is because
in_the_loop()
is true. The 'unlinked home breadcrumb template' will only be shown whenis_front_page() && !$force && !in_the_loop()
. I'm using a FSE theme and I think that in every FSE theme `in_the_loop()is always true (but I'm not 100% sure). If my assumption is correct, then the check for
!in_the_loop()`` is incorrect and shouldn't be there.Can you check this out?
Code: https://github.com/mtekk/Breadcrumb-NavXT/blob/15f974f7cf114f322eb8c757b00d6976cfd8a0a2/class.bcn_breadcrumb_trail.php#L1049C37-L1049C47