Skip to content

Commit

Permalink
Merge pull request #10 from ItinerisLtd/fix-breadcrumbs-on-single-post
Browse files Browse the repository at this point in the history
fix breadecrumbs on single post
  • Loading branch information
danlapteacru authored Nov 16, 2022
2 parents 7e2d97c + 882beb7 commit c3783e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Types/CustomPostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getPostTypes(): array {
fn (WP_Post_Type $postType): bool =>
($postType->has_archive && ! $postType->_builtin
&& ! in_array($postType->name, $post_type_to_ignore, true))
|| 'post' !== $postType->name
|| 'post' === $postType->name
);
}

Expand Down Expand Up @@ -295,7 +295,13 @@ public function breadcrumbLinks(array $links): array
}

$post_type = get_post_type();
$archive_page_id = (int) get_option("page_for_{$post_type}", 0);

if ('post' === $post_type) {
$archive_page_id = (int) get_option('page_for_posts', 0);
} else {
$archive_page_id = (int) get_option("page_for_{$post_type}", 0);
}

if (0 === $archive_page_id) {
return $links;
}
Expand Down

0 comments on commit c3783e7

Please sign in to comment.