Breadcrumbs for Pods CPT

  • Hi there,

    I’m looking to show the breadcrumbs for Custom Post Types created using the PODS WordPress plugin. Currently, the breadcrumbs (implemented with Beaver Builder) only shows Home & The post title. I was wonder if I could change this to follow the URL string, so the end result is:

    Home » pod-name » post-title

    Is this possible? Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can customize the following filter to help you modify your breadcrumbs.

    /**
     * Allow changing or removing the Breadcrumb items
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	return $crumbs;
    }, 10, 2);
    

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    hey Rank-math staff why don’t you also help me with my problem i posted hours ago

    i want to put in focus key words but the page displays when its frozen, i cant even edit my page and posts because Rankmath is active

    Hi Michael,

    I’ve added that code into the functions.php file within my website theme.

    Where can i go to now to update the breadcrumbs for the custom post types?

    Thanks!

    Hello,

    The filter I provided doesn’t work by itself, it need to be modified to make the change. The following is an example, to fit your exact purpose please get in touch with PODs support and forward them this filter.

    /**
     * Allow changing or removing the Breadcrumb items
     *
     * @param array $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
            // Check if we are viewing single posts
    	if(get_post_type() == POD){	
                    // get the pod name of the post
                    $breadcrumbPOD = get_POD_name();
                    // use your pod name as second item in breadcrumb
                    $crumbs[count($crumbs)-1] = $breadcrumbPOD;
    	}
            // And return the breadcrumbs
    	return $crumbs;
    }, 10, 2);
    

    Looking forward to helping you. Thank you.

    ​​​​​​

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

You must be logged in to reply to this ticket.