I was trying to create a custom page template for rendering a certain type of custom post, and it wasn’t working. I created a unique template by making the file name page-mypagename.php where “mypagename” was the title I actually gave the page (this has worked for me before).
After much trial and error I finally got it to work by changing the page url – from mywebsite/customposttypename/ to mywebsite/somethingelse/. Apparently the template didn’t work because the page url used the same name as the custom post type I wanted to render in it.
So I’m left wondering if the existence of a custom post type with a given name somehow interferes with the custom template for a page with the same name in its url.
Also, should typing the custom post type name in the url (say mywebsite/project/ if I have a “project” custom post type) automatically forward me to a posts page for that particular post type? I thought not because I tried this on a different WordPress website and it didn’t work. But it does work on this one.
I’m sorry I can’t give URLs yet because I’m developing the theme locally; it’s not online. But I’d be hugely grateful if anyone could enlighten me about this.
- The topic ‘trouble with custom page template’ is closed to new replies.