I’m trying to get my head around using permalinks with custom post types (CPT).
I have a CPT called ‘Projects’ that contains multiple posts. I have also created a page template called ‘Showreel’ that displays all the ‘Project’ posts. The same posts are also displayed on my homepage in short form with a link to the relevant point on the Showreel page using anchors. When the user clicks on the link from my index page, he is taken to the following link (for example): /showreel#234 where 234 is the relevant post’s ID. I have attached an anchor with name=”234″ to the relevant post.
Now this works fine, but isn’t great – ideally I’d like /showreel/this-project-name and it would have the same effect as /showreel#234.
Because my CPT is called projects, all my custom permalink structures look like %postname%” (I realise this isn’t best practice, but I only have one page apart from index so it should be fine) and come out as /projects/this-project-name” which re-directs back to the homepage with no effect. I know I can use ‘rewrite => slug => showreel’ (omitting proper php formatting) to fake this effect, but I think this will confuse things further as my permalink still has no relation to the page named Showreel.
How can I get my permalinks to behave as I’d like?