Bojana Šekeljić
Bojana Šekeljić

Reputation: 1056

How to get link to custom post type archive page? [wordpress]

I have custom posts loop and at the bottom I want to add "View all" link that should lead to the page with all posts of that type.

The only solution I could think of is to have a template page for the post type and hardcode the link to it, but I am hoping for a more elegant and dynamic solution.

I've checked out the Codex and none of the functions seems to cover this.

Thanks

Bojana

Upvotes: 2

Views: 16390

Answers (2)

thaikolja
thaikolja

Reputation: 431

In case get_post_type_archive_link() returns false, make sure that you have used the argument has_archive => true when using register_post_type().

Upvotes: 8

kel
kel

Reputation: 1597

I belive you are looking for this get_post_type_archive_link('post_type');. More info here: http://codex.wordpress.org/Function_Reference/get_post_type_archive_link

Upvotes: 4

Related Questions