How to link to archive-special.php from custom front-page template?

It looks like I’m trying to do something really simple: Linking to a custom archive page. I’m almost embarrassed that I’m even struggling with this!

I have already created custom post type (books) with template for archive page archive-books.php. Now, my goal is to create a link to go to this archive page. Something like: All Books

The link will be in my front-page, where I have different loops calling different stuff.

  • loop 1 => title : running programs / content : all running programs
  • loop 2 => title : future events / content : all future events
  • loop 3 => title : recent books / content : last 5 registered books

Specifically, I want the link to be placed right after the title, like this:

Loop 3. Title / Link : All Books / Contents …

I know how to achieve this the “amateur way”, using this piece of code:

<a href="https://example.com">All books</a>

But i think there is a “professional way” in which i can use some template tags

my first choice was to try with

<?php post_type_archive_title(); ?> 

But it’s not doing anything, or I don’t know how to set the parameter.

Anyone have any idea about this?

Leave a Comment