is_post_type_archive and breadcrumbs | WordPress.org

[ad_1]

add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_append_link' );

function yoast_seo_breadcrumb_append_link( $links ) {
    global $post;

    if ( is_singular ('post')|| is_post_type_archive( 'post' ) ) {
        $breadcrumb[] = array(
            'url' => site_url( '/resources/' ),
            'text' => 'All Resources',
        );

        array_splice( $links, 1, -2, $breadcrumb );
    }

    return $links;

Hi, I am trying to add a link to breadcrumbs on posts and post archives only. I have a custom post type that I want to have different links on, so I cannot use is_archive( )

I cannot get is_post_archive to work. can anyone help with ideas on how to fix?

I found this old thread, but I don’t; have the skills to implement or understand how they got the workaround to work.

Any help appreciated!

Thanks,

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer