Skip to content

Commit

Permalink
Merge pull request #5 from ItinerisLtd/add-helper-function-to-get-arc…
Browse files Browse the repository at this point in the history
…hive-page-id

helper function to get archive page id
  • Loading branch information
danlapteacru authored Oct 25, 2022
2 parents 5a97fed + b1e91f6 commit cf91fd6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@ function is_search_page(): bool
return get_the_ID() === $custom_search_page_id;
}
}

if (! function_exists('get_archive_page_id')) {
/**
* @param string $postType
*
* @return int
*/
function get_archive_page_id(string $postType): int
{
return (int) get_option("page_for_{$postType}", 0);
}
}

0 comments on commit cf91fd6

Please sign in to comment.