-
AuthorPosts
-
October 16, 2018 at 3:44 pm #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-1017661I 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.
October 18, 2018 at 5:30 pm #1023507Hey (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,
IsmaelOctober 29, 2018 at 8:46 pm #1027736So 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');
October 30, 2018 at 6:25 am #1027877October 30, 2018 at 10:31 am #1027933No 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 = SpeciesAfter 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.
October 30, 2018 at 11:46 am #1027957I found this thread as solution myself:
https://wpml.org/forums/topic/enfold-theme-cant-copy-breadcrumb-hierarchy/#post-893784I 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.phpI 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?October 31, 2018 at 12:17 am #1028297Hi,
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,
IsmaelOctober 31, 2018 at 10:25 am #1028405Alright thanks! I will take a look at the logs when the next patch is available!
November 2, 2018 at 8:51 am #1029070 -
AuthorPosts
- The topic ‘Parent page link works correct but translation doesn't’ is closed to new replies.