Breadcrumb and recent post widget issues

Hi all,

A couple of issues with a client site where I’d appreciate your help:

1) Breadcrumb root page title name
At the moment the breadcrumb for posts appears as > Blog > [post title]. Client wants to change the word “Blog” to something else. Since I’m using the Ethos stack there isn’t a “blog header” toggle to enter a blog title (as advised HERE). Also note there isn’t a blog index page defined in WordPress.

How do I change the breadcrumb root title?

2) “Recent Posts” box width
The blog index page is a ‘normal’ WordPress page (i.e. not tagged in WP as being the “blog” page) with an [x_recent_posts] shortcode in a “content” element. For some reason the very last post entry has a different box width to the others. It’s always the last entry (i.e. if I change the count option in the shortcode the new last entry is wider).

The only custom CSS I have for the Recent Posts widget is

.x-recent-posts-date {
display: none !important;
}

and

.h-recent-posts {
font-weight:500;
padding-bottom:1rem;
}

How do I address this?

Hey Gee,

Thanks for writing in.

As for the Ethos stack, the blog root that shows in the breadcrumbs actually depends on the title of the page that is assigned to the posts page.

So kindly edit your post page and change its page title.

That is because of the default CSS that is in the theme:

.x-recent-posts a:last-child {
    margin-right: 0;
}

To override that, please add this code in the Global CSS:

.x-recent-posts a:last-child {
    margin-right: 4%;
}

Hope this helps.

Wow, that was quick! Thank you so much for getting back to me so quickly.

The CSS to address the “Recent Posts” box width worked perfectly! Thank you.

However the ‘breadcrumbs’ issue is more complex. As I mentioned there is no page assigned as a posts index page. Futhermore I cannot assign the page I’m using as a blog index page since that prevents me from using CornerStone.

There is no page named “Blog”, so the breadcrumb must be using a default.

Hi Gee,

I have just checked in my local setup and did not set a page as a post page and the breadcrumb path has Home Icon > Post Title so it could possibly be a setting specific to your site.

Is there a chance that you can provide us with the admin access to your site in a secure note so that we can check it?

Thank you.

Sure - creds attached as Secure Note

Hi Gee,

Thank you for the credentials. Please try adding this code on your child theme’s functions.php:

function post_parent_trail ($crumbs, $args) {
  if ( is_singular('post') ) {

    $post_ID  = 1180;         
    $post_array = array();
    $post_array[1]['label'] = get_the_title( $post_ID );
    $post_array[1]['url'] = get_permalink( $post_ID );
    array_splice($crumbs, 2, 0, $post_array);

     unset($crumbs[1]);
  }
  return $crumbs;  
}

1180 is the page ID of your Knowledge Base page which I assume is the page you want to see on the breadcrumb instead of Blog, correct?

Note that customization beyond this point is outside the scope of our support. Thank you.

This works great! Thank you so much.

You’re welcome, Gee.

Sorry to be a pain, guys. But while the workaround is great, it doesn’t work for posts under a category.

URLs such as example.com/postname work fine. But URLs such as example.com/category/postname/ the breadcrumb shows the word “Blog”.

Realworld example given as a secure note.

I know Lely said there wouldn’t be any more support for this, but since it’s a modification I was hoping you’d still help…?

Hi Gee,

That’s a category page and not a post page, the above code will only change it for post page. Please change that code to something like this

function post_parent_trail ($crumbs, $args) {
  if ( is_singular('post') || is_category() ) {

    $post_ID  = 1180;         
    $post_array = array();
    $post_array[1]['label'] = get_the_title( $post_ID );
    $post_array[1]['url'] = get_permalink( $post_ID );
    array_splice($crumbs, 2, 0, $post_array);

     unset($crumbs[1]);
  }
  return $crumbs;  
}

Hope this helps.

Works great! Thanks so much - greatly appreciated.

You’re always welcome!

Cheers.

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