• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

perlastudio

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 15, 2019 at 2:45 am in reply to: Including the Parent/Child Custom Post Relationship in Breadcrumbs – Genesis #494005
    perlastudio
    Participant

    JiveDig,

    thanks for help!

    This code working:

    /**********************************
     * BREADCRUMB FOR CPT*
     **********************************/
    function cpt_rolety_zewnetrzne_breadcrumb( $crumb, $args ) {
        
        // Set register CPT
        $registerCustomPostType = 'rolety_zewnetrzne';
        
    	// Only modify the breadcrumb if in the 'rolety_zewnetrzne' post type
    	if( $registerCustomPostType !== get_post_type() )
    		return $crumb;
        
    	    $postType = get_post_type_object(get_post_type());
        
            $parentID = wp_get_post_parent_id($post->ID);
        
            if($parentID == 0) 
                return $crumb;
        
            $parent = get_post($parentID);
        
            $link1 = '<span class="breadcrumb-link-wrap"><a class="breadcrumb-link" href="' . get_post_type_archive_link( $registerCustomPostType ) . '"><span class="breadcrumb-link-text-wrap">' . $postType->labels->singular_name . '</span></a></span>';
    	
            $link2 = '<span class="breadcrumb-link-wrap"><a class="breadcrumb-link" href="'.get_the_permalink($parent->ID) . '"><span class="breadcrumb-link-text-wrap">'.$parent->post_title.'</span></a></span>';
                
            if(!empty($parent))
            {
                
                // Build the breadcrumb
                $crumb = $link1 . $args['sep'] . $link2 . $args['sep'] . get_the_title();
                
            }
    		
    	return $crumb;
    }
    add_filter( 'genesis_single_crumb', 'cpt_rolety_zewnetrzne_breadcrumb', 10, 2 );
    October 13, 2019 at 5:02 am in reply to: Including the Parent/Child Custom Post Relationship in Breadcrumbs – Genesis #493976
    perlastudio
    Participant

    Anita,

    Thanks for article... It was helpful...

    I wrote code:

    /**********************************
     * BREADCRUMB *
     **********************************/
    function cpt_rolety_zewnetrzne_breadcrumb( $crumb, $args ) {
    	// Only modify the breadcrumb if in the 'rolety_zewnetrzne' post type
    	if( 'rolety_zewnetrzne' !== get_post_type() )
    		return $crumb;
    	
            $parentID = wp_get_post_parent_id($post->ID);
        
            if($parentID == 0) 
                return $crumb;
        
            $parent = get_post($parentID);
    	
            if(!empty($parent))
            {
                
                // Build the breadcrumb
                $crumb = '<a href="' . get_post_type_archive_link( 'rolety_zewnetrzne' ) . '">Rolety zewnętrzne</a>' . $args['sep'] . '<a href="'.get_the_permalink($parent->ID).'">'.$parent->post_title.'</a>' . $args['sep'] . get_the_title();
                
            }
    	
    		
    	return $crumb;
    }
    add_filter( 'genesis_single_crumb', 'cpt_rolety_zewnetrzne_breadcrumb', 10, 2 );

    Function working, but links in breadcrumb showing without tag "span" and "class".

    Current:
    <a href="http://xxx/xxx/xxx/">Link Breadcrumb</a>

    Desired:

    <span class="breadcrumb-link-wrap">
        <a class="breadcrumb-link" href="http://xxx/xxx/xxx/">
            <span class="breadcrumb-link-text-wrap">Link Breadcrumb</span>
        </a>
    </span>

    how to fix it?

    Thanks for help.

    Best regards,
    Tomasz Perliński

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble