Currently using the 'maisha' theme. Created custom page to display breadcrumbs for all pages, however, when a sidebar is not applied or turned 'on' in the widgets section, the breadcrumbs disappear. This page situation happens rarely, but in the instance that there is not a need for a sidebar, I would like to have the breadcrumbs. There is multiple parents, each with children, and grandchildren.
Code:
<?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?>
<div class="hfeed site default-page">
<div class="content site-content">
<main class="main site-main" role="main">
<div class="single-themes-page clear news">
<div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">
<?php
if(function_exists('bcn_display'))
{
bcn_display();
}
?>
</div>
<div class="two_third">
<div id="primary" class="content-area">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
// Include the page content template.
get_template_part( 'content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
// End the loop.
endwhile;
?>
</div>
</div>
<div class="one_third lastcolumn">
<div id="sidebar" class="sidebar">
<?php get_sidebar( 'additional-two' ); ?>
</div><!-- .sidebar -->
</div>
</div>
</main><!-- .content-area -->
</div><!-- .site-content -->
</div><!-- .site -->
<?php else: ?>
<div class="hfeed site default-page">
<div class="content site-content">
<main class="main site-main" role="main">
<div class="single-themes-page clear news">
<div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">
<?php
if(function_exists('bcn_display'))
{
bcn_display();
}
?>
</div>
<div id="primary" class="content-area">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
// Include the page content template.
get_template_part( 'content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
// End the loop.
endwhile;
?>
</div>
</div>
</main><!-- .content-area -->
</div><!-- .site-content -->
</div><!-- .site -->
<?php endif; ?>
In the above code, I have applied this code twice:
<div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">
<?php
if(function_exists('bcn_display'))
{
bcn_display();
}
?>
</div>
Once in the beginning of the if statement, and again in the else statement. However, the breadcrumbs does not appear. Am I doing this incorrectly? Is the logic incorrect, or am I misunderstanding the code?
<div class="breadcrumbs">
there with its content?header.php
it will show you what template is being used on the page:<!-- <?php global $template; print_r($template); ?> -->