Hi, I need some help, please. On my site (built with X), in all my posts, breadcrumbs are showing twice (main page > blog post title > blog post title).
I have a custom blog page built with Cornerstone: so one category of my posts are directed to this custom page and the other category of posts go to my Portfolio page (also built with Cornerstone) where I use The Grid. I have searched through your answers and I really don’t have a page assigned as “posts page” (which probably causes my problem) because I wanted to have a custom-made one.
Please, help me find a way to fix it. My site: https://dermol.si
I am running X 5.2.0 (I don’t want to update because of possible WPML incompatibility).
Thanks in advance, Alenka
Hi @alenchy,
Thanks for writing in.
At the moment, I could not configure out why it is showing until I could see your setup.
Would you mind sharing us more details of the setup that you are creating.
Share us your admin credentials so we could check further.
Don’t forget to set it as secure note.
Thanks,
Hi, I sent you my admin credentials via a secure note.
Thanks,
Alenka
Hi Alenka,
To fix it, you can add the code below in your child theme’s functions.php file
function my_breadcrumbs_data( $crumbs ) {
if(is_singular('post')) {
$mycrumbs=array();
foreach($crumbs as $crumb) {
if($crumb['type']=="archive") {
$crumb['url'] =get_permalink(365);
}
$mycrumbs[]= $crumb;
}
}
return $mycrumbs;
}
add_filter( 'x_breadcrumbs_data', 'my_breadcrumbs_data' );
function my_breadcrumbs_args( $args ) {
$args["blog_label"] = "Blog";
return $args;
}
add_filter( 'x_breadcrumbs_data_args', my_breadcrumbs_args );
Hope that helps
Hi,
I did this. Now, I have this warning displayed instead of breadcrumbs on all the pages:
WARNING: INVALID ARGUMENT SUPPLIED FOR FOREACH() IN /HOME/DERMOLSI/PUBLIC_HTML/WP-CONTENT/THEMES/X/FRAMEWORK/FUNCTIONS/GLOBAL/BREADCRUMBS.PHP ON LINE 117
Only the breadcrumbs on a single post are now OK.
Line 117 of breadcrumbs.php is
foreach ( $breadcrumbs as $breadcrumb ) {
Hi there,
Could you try changing this part
function my_breadcrumbs_data( $crumbs ) {
if(is_singular('post')) {
$mycrumbs=array();
foreach($crumbs as $crumb) {
if($crumb['type']=="archive") {
$crumb['url'] =get_permalink(365);
}
$mycrumbs[]= $crumb;
}
}
return $mycrumbs;
}
to this,
function my_breadcrumbs_data( $crumbs ) {
if(is_singular('post')) {
if($crumbs[1]['type']=="archive") {
$crumbs[1]['url'] =get_permalink(365);
}
}
return $crumbs;
}
Then please check it again.
Thanks!
Hi Rad,
great, this works now exactly as it should.
Thanks a lot for your help
Alenka
Thanks Alenka for the update, you are welcome 
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.