I experience an error with my breadcrumbs. I create it to get the homepage>the_archive_title>the_post_title
doesn't always show the name of the archive title .. and when I changed in the $title
variable in get_archive_title()
function to be $title = __(get_the_title());
it fetches the name of archive surely only just in the page of archive, but when I got to page of post it shows
Home>post_title>post_title
So can any one helps me to fix it to show this format
Home > The Archive Title > the post Name
my breadcrumbs code
<h1><?php echo get_the_title() ?></h1>
<div class="breadcrumb">
<a href="<?php echo get_home_url(); ?>">Home</a>
<?php if (is_archive()) { ?>
<a href="<?php echo the_permalink(); ?>"><?php echo get_the_archive_title(); ?></a>
<?php } else { ?>
<a href="<?php echo the_permalink(); ?>"><?php echo get_the_archive_title(); ?></a>
<a href="#"><?php echo get_the_title(); ?></a>
<?php } ?>
</div>