I'm trying to create a agenda in a custom Wordpress theme. On the agenda page there is a simple page-agenda.php template that will include some code that handles the index of the agenda. Quite simple.
But now I would like to 'listen' to the URL that contains a detail page of an agenda item. For example /agenda/1/event-name.
When I visit the above URL I get an page not found error. And when I try to load a template file based on the init hook of wordpress, no content seems to be added to the page and I keep getting the page-not-found page.
SO. How would I load a .php template file base on a URL wildcard like /agenda/1/event-name? So I can show the event data and not get a 404 message.
Thanks!
page-agenda.php
and a Page, you may be better off with a Custom Post Type of "agenda". That way you'll havearchive-agenda.php
as the archive instead of a Page, andsingle-agenda.php
to handle single agendas. I'm not sure where the "1" in your desired URL is coming from, but typically you would set up/agenda/name-of-one-agenda/
style permalinks, and/agenda/
as the archive.