Force Breadcrumbs on portfolio items

Hi,

I’m using the Portfolio custom post type but I am displaying them with The Grid, as that has many more styling options and I can make my own display tiles. Anyway is there a way to make the breadcrumbs show the page the Portfolio item came from? I know you can only set a parent through the theme interface that has a Portfolio template, but surely you can set this with a function…

Thanks!

Hello @becktowery,

Thanks for writing in! Since you do not have a page with a Layout - Portfolio page template and also your homepage is your portfolio page, please add the following CSS code in the X > Theme Options > Global CSS (http://prntscr.com/evui3r) so that your breadcrumb will only have “Home > Portfolio Item Name”.

.x-breadcrumbs .delimiter:nth-child(2),
.x-breadcrumbs a:empty {
    display: none;
}

Hope this helps. Please let us know how it goes.

Thanks, this is good to know. BUT what I need is for the breadcrumb to display the page the portfolio item came from. I’m still developing so I dont know what that page name is, but it needs to be something like Home/Samples/Portfolio Item Name instead of what I get now: Home/ /Portfolio Item Name

Hi @becktowery,

Unfortunately, it’s only limited to current feature as of now and it’s specifying the parent portfolio page. Though, it may require customization if you plan to change the existing breadcrumb structure, please check this https://theme.co/apex/forum/t/change-nam-of-blog/53565/13

It’s similar, but you would need to follow same implementation but for portfolio. Example

add_filter('x_breadcrumbs_data', 'post_parent_trail', 9999999, 2);

function post_parent_trail ($crumbs, $args) {
  if ( is_singular('x-portfolio') ) {

    $crumbs[1]['label'] = 'Sample';
    $crumbs[1]['url'] = 'http://example.com/portfolio-main-page';
    
  }
  return $crumbs;
}

$crumbs[0] is equal to home
$crumbs[1] is equal to portfolio parent
$crumbs[2] is equal to portfolio item

And so on… :slight_smile:

Hope this helps.

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