Change portfolio parent

I am using the essential grid for my portfolio page. Because I want to use another page template then “portfolio page”. But now I can’t add my custom portfolio page as the portfolio parent to my portfolio item. There is only the "default "option. That means that on the portfolio single page in the breadcrumbs the parent of the portfolio item is missing. It shows “home” -> “portfolio item”. But it should be: “home” ->“custom portfolio page”-> “portfolio item”. Do you have the advice to solve this?

Thanks for helping.

Yours
Stephen

1 Like

Hi there,

We have a bug in our theme regarding the Portfolio parent item detection in the breadcrumbs section. We already reported this and it is in our issue tracker.

A temporary fix is to install the Child Theme and add the code below to the functions.php file:

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

function bc_portfolio_parent_link ($crumbs, $args) {
  if ( is_singular('x-portfolio') ) {
    if ( x_is_portfolio_item() ) {
      $link = x_get_parent_portfolio_link();
    } elseif ( x_is_product() ) {
      $link = x_get_shop_link();
    }

    $crumbs[1]['url'] = $link;
  }
  return $crumbs;
}

I am not sure if it will fix your case as your case seems to be a customization case which is not available on the theme out f the box and is outside of our support scope. But I wanted you to know about the bug that we have and how to fix it to have the correct functionality in the original theme.

Thank you.

I tried that already, but I suppose this only works for page template “Layout - Portfolio”. Excuse me, but this should not be a big thing to add all pages to the drop-down of “parent page” but extremely useful. Please help. This is really missing. I can’t edit the Portfolio Layout without coding (e.g. with cornerstone) and so I have to use a custom Page.

Please do your best.

Thank you
Stephen

Hi there,

Yes, it does and should work on “Layout - Portfolio” which was set-up as the parent of a portfolio item/post. You can’t use that code on any page that isn’t set up as portfolio index page. But, regardless, you need to do the coding and enhance it to implement it to your custom portfolio page. Example,

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

function bc_portfolio_parent_link ($crumbs, $args) {
  if ( is_singular('x-portfolio') ) {
    $crumbs[1]['url'] = 'http://example.com/custom-portfolio-page/';
    $crumbs[1]['label'] = 'custom portfolio page';
  }
  return $crumbs;
}

Thanks!

1 Like

Thank you so much. That’s it! :smiley:

You’re most welcome!

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