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


It seems to me that I am trying to do something really simple : linking to a custom archive page. I’m almost ashamed that I’m struggling with this !

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

The Link will be in my front-page, where I have different loops that are calling different contents.

  • Loop 1 => Title : Ongoing Events / Content : All the Ongoing Events
  • Loop 2 => Title : Future Events / Content : All the Future Events
  • Loop 3 => Title : Recent Books / Content : The Last 5 Books registered

Specifically, I want to put the link just after the title, like this :

Loop 3. The Title / Link : All books / Content …

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

<a href="">All books</a>

But I suppose that 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 is not doing anything, or I don’t know how to set the parameters.

Someone has an idea about this ?

Gadget 1 year 2022-11-14T13:58:17-05:00 0 Answers 0 views 0

Leave an answer