Support » Plugin: Flexy Breadcrumb » Breadcrumb + Polylang – multilanguage v2

Viewing 3 replies - 1 through 3 (of 3 total)
  • Arsalan Ahmed

    (@arsalanahmed901)

    Hi @rmsaraiva,

    Thanks for writing to us.

    This is caused due to an issue with the multilingual URLs so here we recommend you to ask about it from the Polylang plugin support team. We hope they can better serve you regarding this matter.

    Thank you for writing to us. Let us know if we can assist you further.

    Regards,

    Thread Starter rmsaraiva

    (@rmsaraiva)

    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. 🙂

    Arsalan Ahmed

    (@arsalanahmed901)

    Hi @rmsaraiva,

    We are glad to hear that the issue has been resolved with little modification.

    We also hope it helps the community.

    Feel free to reach out for further assistance.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Breadcrumb + Polylang – multilanguage v2’ is closed to new replies.