-
Author
-
May 8, 2018 at 18:00 #197117tipinoncomuniParticipant
I want my breadcrumb shows a custom field text instead of the post title text.
Is there a way to that?
I have seen that i can customize the title but that customized text will be shown in the breadcrumb too.
May 9, 2018 at 00:40 #197162LauraModeratorHello, i am not sure i understand your request, can you share more details?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
May 9, 2018 at 01:49 #197165tipinoncomuniParticipantA) The first page is “Aziende in Emilia Romagna” (Alaska Companies) – slug: “alaska” – custom field: “Alaska”
B) The children page is “Aziende produttrici” (Farm Companies) – slug “producers” – custom fields “Producers”
C) The children of the children page is “Aziende produttrici di Vegetali e Cereali” (Farm producing vegetables and cereals)The normal breadcrumb for page “C” is:
Aziende in Emilia Romagna / Aziende produttrici / Aziende produttrici di Vegetali e Cereali
That’s very long and unuseful
I desire to use the custom fields values to create a better breadcrumb:
Alaska / Producers / Vegetable & CerealsIs there a Kleo hook to force a custom breadcrumb?
May 9, 2018 at 21:44 #197274LauraModeratorHello, you could use the slug for breadcrumbs, try by adding this to functions.php of child theme
If there is an error, go to your hosting file manager and delete the code you just added
COPY CODEif ( is_page() ) { $post = $wp_query->get_queried_object(); if ( $post->post_parent == 0 ){ echo "<li> » ".ucwords(str_replace("-", " ", $post->post_name))."</li>"; } else { $title = the_title('','', FALSE); $ancestors = array_reverse( get_post_ancestors( $post->ID ) ); array_push($ancestors, $post->ID); foreach ( $ancestors as $ancestor ){ if( $ancestor != end($ancestors) ){ echo '<li> » <a href="'. get_permalink($ancestor) .'">'. ucwords(str_replace("-", " ", basename(get_permalink($ancestor)))) .'</a></li>'; } else { echo '<li> » '. ucwords(str_replace("-", " ", basename(get_permalink($ancestor)))) .'</li>'; } } } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.