• Resolved animish

    (@animish)


    Hello!

    I have created a custom post type : “Movies”. But I have disabled the archive (has_archive) for this post type. Hence, in breadcrumb links it simply shows : “Home ? The post name”.

    Instead of archives, I have created a separate page, which shows links to all the posts under my custom post type. I want that page to appear in the breadcrumbs. So that, “Home ? My_page_link ? The post name”.

    Is this possible? Please help.

    Thanks in advance.

    https://www.ads-software.com/plugins/wordpress-seo/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter animish

    (@animish)

    Or else, suggest me if I can edit any plugin file, and what to edit in that file.

    Thanks in advance.

    Thread Starter animish

    (@animish)

    OK. I found the solution. I put the following code in theme’s functions.php file.

    function my_wpseo_breadcrumb_links( $links ) {
        global $post;
        if ( is_singular && get_post_type() == 'wp_tut' ) {
            $breadcrumb[] = array(
                'url' => 'https://mysite.com/movies/',
                'text' => 'Movies',
            );
            array_splice( $links, 1, -2, $breadcrumb );
        }
        return $links;
    }
    add_filter( 'wpseo_breadcrumb_links', 'my_wpseo_breadcrumb_links' );
    Thread Starter animish

    (@animish)

    I am closing the topic now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Assign a page to custom post type in breadcrumbs’ is closed to new replies.