Hello @arsalanahmed901 ! ??
I was able to sort it myself with a piece of customization on file flexy-breadcrumb/includes/class-flexy-breadcrumb-trail.php on public function fbc_home_template().
The updated function looks like:
public function fbc_home_template() {
$fbc_settings_options = get_option('fbc_settings_options');
$fbc_front_text = $fbc_settings_options['breadcrumb_front_text'];
$fbc_home_icon = $fbc_settings_options['breadcrumb_home_icon'];
// Separator Template
$separator_template = $this->fbc_separator_template();
// Home Text & Icon
if ($fbc_front_text || $fbc_home_icon) {
/* Ricardo custom code START */
$home_url_language = get_home_url();
$site_locale = substr(get_bloginfo('language'), 0, 2);
if($site_locale != 'pt') { /* hardcoding the default language */
$home_url_language .= '/' . $site_locale;
}
/* Ricardo custom code END */
?>
<li itemprop="itemListElement" itemscope itemtype="<?php echo esc_url("https://schema.org/ListItem"); ?>">
<span itemprop="name">
<!-- Home Link -->
<a itemprop="item" href="<?php echo esc_url($home_url_language); ?>"><!-- updated esc_url argument -->
<?php if ($fbc_home_icon): ?>
<i class="fa <?php echo esc_attr($fbc_home_icon); ?>" aria-hidden="true"></i><?php
endif;
if ($fbc_front_text):
echo esc_attr($fbc_front_text);
endif;
?>
</a>
</span>
<meta itemprop="position" content="1" /><!-- Meta Position-->
</li><?php echo $separator_template;
}
}
Idea is:
- Get site current locale
- Check if it’s different from default language I set in Polylang (this is hardcoded as ‘PT’
- If so, attaches the locale
Hopes this helps more developers. ??