Show Main Blog Page Link in Divi Breadcrumbs Module

|

My Divi Breadcrumbs Module allows you to display breadcrumbs links on your Divi site. The breadcrumbs for a post or archive page by default include a link to the homepage. If you have configured a separate static "Posts Page" (in "Settings > Reading") and would like to include a link to it in your breadcrumbs too, you can do so using the following PHP:

add_filter('et_pb_dmb_breadcrumbs_crumbs', 'dbc_show_blog_page_link');

if (!function_exists('dbc_show_blog_page_link')) {
	function dbc_show_blog_page_link($crumbs) {
		if ((is_array($crumbs)) &&
			(is_single() || is_archive()) && 
			(get_option('show_on_front') === 'page')) { 	
			$blog_id = get_option('page_for_posts');
			array_splice($crumbs, 1, 0, array(
				array(
					'text'=>get_the_title($blog_id), 
					'url'=>get_permalink($blog_id)
				)
			));
		}
		return $crumbs;
	}
}

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin

0 Comments

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.