Change breadcrumb link

Hi there,

I am about to create a blog page on my site www.sandandseagulls.co.uk but do not want to use the standard wordpress blog page functionality. Instead, I am going to create a new page and use ‘the grid’ plugin the display my blogs.

The problem with this is that when I go into a blog post the breadcrumbs at the top of the page automatically use the standard wordpress blog page, how to I edit the link so that it points to my custom blog page?

Thanks

Hi There,

Please try adding this custom code under functions.php file locates in your child theme:

add_filter( 'x_breadcrumbs_data', 'x_blog_breadcrumb', 10, 2 );
function x_blog_breadcrumb($crumbs, $args){
	$crumbs[1] = array(
		'type'  => 'blog',
		'url'   => get_permalink(7981),
		'label' => $args['blog_label'],
	);
	return $crumbs;
}

Hope it helps :slight_smile:

1 Like

Thanks, sorry im probably being thick but where do i put the url of my custom blog page in that code?

Hi @zoepayne42,

First, determine the permalink or the id of your custom blog.

then change the 'url' => get_permalink(7981),

If we are missing something or we are not following what you want to achieve. Please share us more details of what you want to achieve.

Thanks.

Hi, thanks but but pleasr can you explain exactly what you mean by “then change the ‘url’ => get_permalink(7981),” ?

Thanks

Hi,

You need to change the number 7981 with your blog page id.

Check this link on how to find your page id.

Thanks

perfect thanks. The post ID for the page I wanted was 7981, didn’t realise you had already worked out that 7981 was the page ID i needed to use which is what confused me!

Thanks

You are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.