Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #915427

    Hi,

    Coming back on an issue that finally needs to be solved properly…

    Please look at the breadcrumb in following single portfolio page: U bevindt zich hier: Home / Boeken / Noortje / Noortje viert carnaval.

    When you click on language English, you will see the English version of the same book with the following breadcrumb: You are here: Home / Boeken / Noortje / Noortje Celebrates Carnival.

    The category name “Boeken” is somehow not being translated into “Books”. Please see also attached screen prints for clarification.

    Can you explain why this is going wrong and what I can do to solve this?

    Thanks & regards,
    Monique

    #915485

    Hey Monique,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #915499

    Hi Victoria,

    Please find below.

    Note: please do not change the WP read settings nor Enfold Child page settings! The settings as it is now is needed in combination with Polylang. If you change it the whole multi language page and post structure won’t work anymore as it should.

    Looking forward to your further info.

    Regards,
    Monique

    #915530

    Hi,

    Best regards,
    Victoria

    #915542

    Hi Victoria,

    Thanks for your quick reply. I understand what you mean: the two pages were both in English, I did not “connect” the correctly. I’ve corrected this, so we now have one page in Dutch “Boeken” and one page in English “Books”. However that does not solve the breadcrumb issue… :-(

    Please advise.

    Regards,
    Monique

    #915840

    Hi Monique,

    Do you have the database cache? It takes Dutch page for the breadcrumbs, not the English one.

    Best regards,
    Victoria

    #915842

    Hi,

    Thank you for the update. We added this filter in the functions.php file.

    // portfolio breadcrumb
    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 20, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) {
        if( is_singular('portfolio') && pll_current_language() == 'en' ) {
            $home = $trail[0];
            $last = array_pop($trail);
            $books = get_post(480);
    
            if(!empty($books))
            {
                $link = '<a href="'.get_the_permalink($books->ID).'">'.$books->post_title.'</a>';
                $link = preg_replace('!rel=".+?"|rel=\'.+?\'|!',"", $link);
                $link = str_replace('<a ', '<a rel="v:url" property="v:title" ', $link);
                $link = '<span typeof="v:Breadcrumb">'.$link.'</span>';
                $trail[1] = $link;
    
                $trail = array(0 => $home, 1 => $link, 2 => $trail[2], 'trail_end' => $last);
    		}
        }
    
        return $trail;
    }
    

    The filter should return the “books” page on the single portfolio page and only if the language is set to English.

    Best regards,
    Ismael

    • This reply was modified 6 years, 10 months ago by Ismael.
    #915951

    Hi Ismael,

    This is really great! You guys rock! The 5 stars you get are well deserved :-)

    One more question. I had exactly the same problem with my own website. Thought to change your am code to get it to work there too, but I get a blank page. So obviously I missed something. The code I thought to use is:

    // portfolio breadcrumb
    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 20, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) {
        if( is_singular('portfolio') && pll_current_language() == 'en' ) {
            $home = $trail[0];
            $last = array_pop($trail);
    
            $my-work = get_post(4818);
    
            if(!empty($my-work))
            {
                $link = '<a href="'.get_the_permalink($my-work->ID).'">'.$my-work->post_title.'</a>';
                $link = preg_replace('!rel=".+?"|rel=\'.+?\'|!',"", $link);
                $link = str_replace('<a ', '<a rel="v:url" property="v:title" ', $link);
                $link = '<span typeof="v:Breadcrumb">'.$link.'</span>';
                $trail[1] = $link;
    
                $trail = array(0 => $home, 1 => $link, 2 => $trail[2], 'trail_end' => $last);
    		}
        }
    

    Could you please verify? Login details below.

    Thanks & regards,
    Monique

    #916705

    Hi Monique,

    This is not a correct way to name a variable https://cl.ly/0v0M1C0p3N14
    Change it to $myWork and try the code again.

    Best regards,
    Victoria

    #924459

    Hi Victoria,

    I assume that sometimes you LOL? ;-)

    Sorry but I seem not to be able to get this to work. Either the page turns blank or the breadcrumb gets completely mixed up…

    Would you please be so kind to submit me the full code to get the breadcrumb right on a single portfolio page in English? Speaking with Ismael’s words: the filter should return the “My Work” page on the single portfolio page and only if the language is set to English.

    Thanks & regards,
    Monique

    #925050

    Hi,

    Try the code as following

    // portfolio breadcrumb
    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 20, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) {
        if( is_singular('portfolio') && pll_current_language() == 'en' ) {
            $home = $trail[0];
            $last = array_pop($trail);
    
            $myWork = get_post('4818');
    
            if(!empty($myWork))
            {
                $link = '<a href="'.get_the_permalink($my-work->ID).'">'.$my-work->post_title.'</a>';
                $link = preg_replace('!rel=".+?"|rel=\'.+?\'|!',"", $link);
                $link = str_replace('<a ', '<a rel="v:url" property="v:title" ', $link);
                $link = '<span typeof="v:Breadcrumb">'.$link.'</span>';
                $trail[1] = $link;
    
                $trail = array(0 => $home, 1 => $link, 2 => $trail[2], 'trail_end' => $last);
    		}
        }

    If not work, share us access. Maybe one of the variables are wrong.

    Best regards,
    Basilis

    #926581

    Hi Basilis,

    Unfortunately the site turns blank with this code. Please find access details below.

    Regards,
    Monique

    #927662

    Hi,

    can u also send ftp – just if we brake something :)

    Best regards,
    Basilis

    #928014

    Hi Basilis,

    Please find below.

    Best regards,
    Monique

    #929538

    Hi,

    Thank you for the info. We added the code in the functions.php file. Please remove browser cache or do a hard refresh before checking the page.

    Best regards,
    Ismael

    #929822

    Wow you’re really great! Thanks so much for your help!

    Can you flag this topic as solved please?

    Best regards,
    Monique

    #929982

    Hi,

    Sure, glad that this is resolved. Thanks for using Enfold and have a great day :)

    Best regards,
    Nikko

Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘Portfolio category name in breadcrumb not translated’ is closed to new replies.