Tagged: breadcrumbs
Hi, I want to modify first link and name in the breadcrumbs navigation. Now there is by default blog home and but I need have another blog page. What shall I modify to achieve this functionality?
Thank you
Martin
Hi marthen!
We do have a filter for that
add_filter('avia_breadcrumbs_args', 'avia_change_home_breadcrumb', 10, 1);
function avia_change_home_breadcrumb($args){
$args['show_home'] = 'CHANGE THE HOME TEXT HERE';
return $args;
}
Give it a look and let us know if we can help you with anything else
Best regards,
Basilis
Hi Basilis,
thank you for the reply. Where shall I put the filter code? At the same time I need to change also the link for the new home text. What is the right parameter for URL change?
Martin
Hey!
Add the code in the functions.php file. Replace it with:
add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mods', 50, 2 );
function avia_breadcrumbs_trail_mods( $trail, $args ) {
$homeurl = 'URL HERE';
$hometitle = 'TITLE HERE';
if ( is_front_page() ) return;
$trail[0] = '<a href="' . $homeurl . '" title="' . esc_attr( get_bloginfo( 'name' ) ) . '" rel="home" class="trail-begin">'. $hometitle .'</a>';
return $trail;
}
Adjust the value of the $homeurl and $hometitle.
Best regards,
Ismael
Thank you. Is it possible to have two different breadcrumbs trails? Actually we have 2 homes – for public pages and members pages.
Martin
Hi!
You can try the is_page conditional. https://developer.wordpress.org/reference/functions/is_page/
Regards,
Ismael