I wrote this code for 2 custom post types to link back to their respective index
pages from the single post view. It works. However the “Portfolio” and “Artwork” will have multiple pages and I am unclear on what to append to this code to recognize those additional pages as they are created by the user. The page name progression is (for example) portfolio/page/2/
, portfolio/page/3/
etc, but all single post breadcrumbs are linking back to the first custom post type index page. Any help is so appreciated but please be concise because my coding skills and WordPress knowledge are intermediate at best.
global $post;
$type = get_post_type($post->ID);
if($type == 'portfolio'){
echo '<a href="' . 'http://www.foo.com/portfolio' . '">' . 'Portfolio' . '</a>' . $markup;
} else if($type == 'artwork'){
echo '<a href="' . 'http://www.foo.com/artwork' . '">' . 'Artwork' . '</a>' . $markup;
}}