Hi,
For some reason the breadcrumbs for my CPT archive page looks like: home / Auto draft / CPT name
Not sure what happens here (anyone?), but I found this code https://kriesi.at/support/topic/breadcrumbs-for-custom-post-type/#post-400019 to do some filtering. This code however gave me the ID of the homepage in the breadcrumb trail. I reckon it has to do with the avia_get_option('frontpage');
code?
I managed to make it work with the adjusted code below, but I was wondering what the avia_get_option('frontpage');
actually does. Does it solely provide the ID of the frontpage? I would like to know, since I now use it for the get_permalink
and get_the_title
function.
Thanks
//Change Breadcrumb Bug for CPT Archive
add_filter('avia_breadcrumbs_trail', 'av_cc_change_breadcrumb', 20, 1);
function av_cc_change_breadcrumb($trail) {
if(is_post_type_archive( 'cpt_slug' ) ) :
$home = avia_get_option('frontpage');
$homepage = '<a href="'. esc_url( get_permalink( $home ) ) . '">' . get_the_title( $home ) . '</a>';
$page = '<a href="'. get_post_type_archive_link( 'cpt_slug' ) . '">' . post_type_archive_title( '', false ) . '</a>';
$trail = array(0 => $homepage, 1 => $page);
endif;
return $trail;
}
Hey wzshop,
Sorry for the delay. Yes, the avia_get_option(‘frontpage’) will only return the front page ID. Sorry about that. Quite odd that it worked for the previous user. He probably missed it like I did.
Best regards,
Ismael
Hi Ismael,
Thank you for your response!