The easiest way to custom the template of archive-xxx.php ?
-
Hello,
My client want to be able to post his own receipts. There is already A LOT of “normal” post, so it is easier for my client to have a tab “Receipts” in the admin menu (and he asked for it). So I created a Custom Post Type with the plugin Types. The slug is “receipts”.
It is important to know that:
– https://www.site.com/receipts/ (archive-receipts.php) does not act like archives.php because in this case, it do not have to list the posts but it must display a custom content (content like a page).
– https://www.site.com/receipts/title-of-his-receipt/ (single-receipts.php) has to show information about a receipts
– It important to have the same slug for theses pages (so https://www.site.com/receipts/ and https://www.site.com/receipts-2/title-of-his-receipt/ or NOT allowed by the client).But as you know:
1/ The header “Template Name” does not work on archive.php…
2/ There is a little trick but with a lot of restrictions: if you create a CPT “receipts” with Types then you create a page with the same slug “receipts” it will work but WordPress will give the priority to archive.php and will never show your page. And you can not edit your CPT because Types does not allow to have the same slug. So it does not help a lot…
So is there a easy way to custom the template “archive-receipts.php” ? In my case, I do not want to enter in the main loop of the posts (like archives.php) because I dont need to display them.
Thanks you
- The topic ‘The easiest way to custom the template of archive-xxx.php ?’ is closed to new replies.