Calling post type archive permalink on breadcrumbs
-
I am now trying to create a custom breadcrumbs on my WordPress site, but I am now struggling of calling a permalink of custom post type archive, that because calling a custom post archive permalink requires a post type string like here
get_post_type_archive_link( string $post_type )
, but this is impossible to do on breadcrumbs because it should be dynamic for each custom post type. Someone suggest me to try usingget_queried_object_id()
but I don’t know how to combine it withget_post_type_archive_link( string $post_type )
to call the link. here is my breadcrumb codes:function my_breadcrumb() { $postType = get_post_type_object(get_post_type()); echo '<a href="'.home_url().'" rel="nofollow">Home</a>'; if ((get_post_type() || is_single()) && !is_search()) { echo " ? "; echo '<span style="text-transform: capitalize;">'; echo esc_html($postType->labels->singular_name); echo '</span>'; if (is_single()) { echo " ? "; the_title(); } } };
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Calling post type archive permalink on breadcrumbs’ is closed to new replies.