Title: Toolset Types &#8211; Custom Post Types
Last modified: August 26, 2018

---

# Toolset Types – Custom Post Types

 *  [mackiecompany](https://wordpress.org/support/users/mackiecompany/)
 * (@mackiecompany)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/toolset-types-custom-post-types/)
 * Toolset Types – Custom Post Types
 * Hi
 * I’ve created a custom post type called “Collaborations” and selected Pages as
   the Parent Post Types.
 * In each post I’ve selected Post Relation “About” page.
 * In the Yoast breadcrumb the “About” page isn’t included in the path. Is this 
   possible to achieve?
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftoolset-types-custom-post-types%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Anonymous User 14808221
 * (@anonymized-14808221)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/toolset-types-custom-post-types/#post-10630910)
 * It will require some custom code.
 * You can find some hints for custom code examples here:
    [https://toolset.com/forums/topic/adding-parent-and-child-options-to-yoast-custom-post-type/](https://toolset.com/forums/topic/adding-parent-and-child-options-to-yoast-custom-post-type/)(
   It’s not possible natively) Custom code: [https://toolset.com/forums/topic/2-custom-post-types-can-one-be-the-parent-of-the-other-and-display-breadcrumbs/](https://toolset.com/forums/topic/2-custom-post-types-can-one-be-the-parent-of-the-other-and-display-breadcrumbs/)
   No Code solution (REquires Toolset) [https://toolset.com/forums/topic/dont-display-listings-cpts-unless-category-has-no-child-categories/](https://toolset.com/forums/topic/dont-display-listings-cpts-unless-category-has-no-child-categories/)
 *  Thread Starter [mackiecompany](https://wordpress.org/support/users/mackiecompany/)
 * (@mackiecompany)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/toolset-types-custom-post-types/#post-10659824)
 * Hi Beda
 * I’m not sure I fully understand.
    For the custom post type do I use the slug “
   collaboration” or the plural name “Collaborations”?
 * [http://sg-demo2.getondigitaldesign.co.uk/category/collaborations/](http://sg-demo2.getondigitaldesign.co.uk/category/collaborations/)
 * if the parent is a page about_us_and_collaborations
    [http://sg-demo2.getondigitaldesign.co.uk/about_us_and_collaborations/](http://sg-demo2.getondigitaldesign.co.uk/about_us_and_collaborations/)
 * where does that go in the code below?
 * add_filter(‘wpseo_breadcrumb_links’, ‘add_my_ancestors’);
    function add_my_ancestors(
   $links) { if (get_post_type() == ‘collaboration’) { $parent = get_post_meta(get_the_ID(),‘
   _wpcf_belongs_company_id’, true); array_splice($links, sizeof($links) – 1, 0,
   array(array(‘id’ => $parent))); } return $links; }
 * Many Thanks
    Scott
 *  Anonymous User 14808221
 * (@anonymized-14808221)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/toolset-types-custom-post-types/#post-10661831)
 * Those are custom code examples, which I cannot provide or assist here.
 * However, I have to apologise as one above link is wrong.
    This one is about to
   add a post type of YOAST to the relationships, not about putting related posts
   into their breadcrumb: [https://toolset.com/forums/topic/adding-parent-and-child-options-to-yoast-custom-post-type/](https://toolset.com/forums/topic/adding-parent-and-child-options-to-yoast-custom-post-type/)
 * In the code shared here though,
    [https://toolset.com/forums/topic/2-custom-post-types-can-one-be-the-parent-of-the-other-and-display-breadcrumbs/#post-34778](https://toolset.com/forums/topic/2-custom-post-types-can-one-be-the-parent-of-the-other-and-display-breadcrumbs/#post-34778),
   you would alter the code thereby changing `employee` to the _slug_ of your post
   type. Then, in `$parent = get_post_meta(get_the_ID(), '_wpcf_belongs_company_id',
   true);` you would have to manipulate `_wpcf_belongs_company_id` and replace `
   company` with the _slug_ of the related post type (parent type).
 * That line will get the ID of _the single_ Post (companies in this example) that
   is related to the current Post (employee in the example) (hence, is it’s parent).
 * Then, with `array_splice($links, sizeof($links) - 1, 0, array(array('id' => $
   parent)));`
    it actually populates the Bradcrumbs using the Post ID of `$parent`(
   the related post)
 * Since that plugin offers a filter for their breadcrumbs you can hook the above
   new data to that output with `add_filter('wpseo_breadcrumb_links', 'your_custom_callback');`
 * So the whole code is:
 *     ```
       add_filter('wpseo_breadcrumb_links', 'your_custom_callback');
       function your_custom_callback($links) {
           if (get_post_type() == 'your-post-type-slug-of-child-type') {
               $parent = get_post_meta(get_the_ID(), '_wpcf_belongs_your-post-type-slug-of-child-type_id', true);
               array_splice($links, sizeof($links) - 1, 0, array(array('id' => $parent)));
           }
           return $links;
       }
       ```
   
 * Let me know if you can proceed with this.
 * Please also remember that Types will be discontinued by end of 2018:
    [https://toolset.com/2017/11/types-plugin-is-moving-to-be-a-part-of-the-complete-toolset-package/](https://toolset.com/2017/11/types-plugin-is-moving-to-be-a-part-of-the-complete-toolset-package/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Toolset Types – Custom Post Types’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/types_ced1d3.svg)
 * [Toolset Types - Custom Post Types, Custom Fields and Taxonomies](https://wordpress.org/plugins/types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/types/)
 * [Active Topics](https://wordpress.org/support/plugin/types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/types/reviews/)

## Tags

 * [page](https://wordpress.org/support/topic-tag/page/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [relation](https://wordpress.org/support/topic-tag/relation/)

 * 3 replies
 * 2 participants
 * Last reply from: Anonymous User 14808221
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/toolset-types-custom-post-types/#post-10661831)
 * Status: not resolved