Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1022234

    Hi,

    In this post I asked about changing parent pages in bulk through a function:
    https://kriesi.at/support/topic/breadcrumbs-according-to-session/#post-1017661

    I got this code and the links are working right but the translation has a problem (I use WPML).
    See the example in private content. (IST 720)
    In the English version and Dutch version it works correct. In the German version ‘Medisch verpakken’ in the breadcrumb needs to be translated to the German page title of it which is ‘Medizinische verpackungen’. When I click on the link it navigates to the right German page but what I said earlier is the name is Dutch.

    Hope you guys can help.

    #1023507

    Hey (Email address hidden if logged out) ,

    Thank you for using Enfold.

    Try to update the post meta of the translated pages. This thread might help.

    // https://wpml.org/forums/topic/get-translated-post-id/

    Get the id of the translated pages based on the original page’s id.

    $translated_id = icl_object_id($article->ID, 'portfolio', false,ICL_LANGUAGE_CODE);
     if( $translated_id ) {
        update_post_meta($translated_id, 'breadcrumb_parent', 1980);
     }

    `

    Best regards,
    Ismael

    #1027736

    So if i’m understanding your comment I need to set the breadcrumbs again but with this as new function?

    function avia_add_all_breadcrumb_parent()
    {
        $args = array('posts_per_page' => -1, 'post_status' => 'any',  'post_type' => array('portfolio'), 
            'tax_query' => array(
                array(
                    'taxonomy' => 'portfolio_entries',
                    'field' => 'term_taxonomy_id',
                    'terms' => array(26, 25, 24)
                )
    	)); 
        $articles = new WP_Query( $args );
    
    	$translated_id = icl_object_id($article->ID, 'portfolio', false,ICL_LANGUAGE_CODE);
     if( $translated_id ) {
        update_post_meta($translated_id, 'breadcrumb_parent', 1980);
     }
    
        wp_reset_postdata();
    }
    add_action('wp_head','avia_add_all_breadcrumb_parent');
    #1027877

    Hi,

    Yes, that is it. Is it working?

    Best regards,
    Ismael

    #1027933

    No it doesn’t work.
    Is there an option to set the breadcrumb parent for a portfolio-item in the main language and it automatically understands it for the other languages?

    Like in main language english:
    Portfolio-item = Coffee
    Breadcrumb-parent = Species

    After setting the breadcrumb parent Species for Coffee the system needs to understand to do this for the other languages too.
    Like when set in English as above it automatically understands the translations like:
    Dutch:
    Portfolio-item translation = Koffie (translation of Coffee)
    Breadcrumb-parent translation = Soorten (translation of page Species)

    If there is a solution for this I only have to set the breadcrumb parent once for each portfolio-item

    • This reply was modified 6 years ago by Jarmo.
    #1027957

    I found this thread as solution myself:
    https://wpml.org/forums/topic/enfold-theme-cant-copy-breadcrumb-hierarchy/#post-893784

    I need to make a change in the following file: wp-content/themes/enfold/framework/php/class-breadcrumb.php
    I want to make this change into my child theme but then it won’t work.
    My child theme folders are like this: wp-content/themes/enfold-child/framework/php/class-breadcrumb.php

    I made the change in class-breadcrumb.php but this doesn’t have any effect.
    How can I make the right change through my child theme?

    #1028297

    Hi,

    You can keep the modification in the parent theme for now. I’ll push this thread to the dev team so that they can include that filter in the next patch.

    Best regards,
    Ismael

    #1028405

    Alright thanks! I will take a look at the logs when the next patch is available!

    #1029070

    Hi,

    Alright. Please open a new thread if you need anything else. We’ll close this one now.

    Best regards,
    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Parent page link works correct but translation doesn't’ is closed to new replies.