Opened 9 years ago
Closed 8 years ago
#34428 closed enhancement (wontfix)
New function `has_archive_post_type()`
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
Function will be check that custom post type has archive. For example:
<?php if(has_archive_post_type('cpt')) : ?> <a href="<?php echo get_post_type_archive_link('cpt');?>">My Special Archive Link</a> <?php endif;?>
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
get_post_type_archive_link
returns false when a post type doesn't have an archive. You could just do: