I have a custom post type called event. The URL structure looks like this.
Where "workshop" is the name of the event. Right now the template will show different data depending on the query string. For example this URL:
Will loop out some files. I'm adding the query string so i can do that in the same template.
<?php
$sub = isset( $_GET['sub'] ) ? $_GET['sub'] : null;
switch ( $sub ) {
case "files":
echo "TODO: Loop out files";
break;
case "participants":
echo "TODO: Loop out participants";
break;
case "agenda":
echo "TODO: Write out the agenda!";
break;
<!-- etc -->
}
?>
But i don't like this URL structure! I'd like the URL to be:
So that i in the "Event" template (/workshop/) can look at the URL structure instead of the query string. The problem is that adding /filesto the URL will make wordpress look for a page that doesn't exist and give a 404.
Is it possible to do some URL wizardry so the template (and post data) of this url:
Also kicks in with this URL:
http://web.site/events/2016/08/16/hello-world?sub=fileshttp://web.site/events/1999/12/31/new-years?sub=imagesto strip?sub=and replace it with a/to be2016/08/16/hello-world/files?.../events/2016/08/21/workshop?sub=filesbut you want the structure to be/events/2016/08/21/workshop/filesinstead. Where/filesis another page template? You're gonna have to clarify your question more. Since I'm not the only one not understanding it entirely./filesto use the same template (and post object) as the "Event" (/workshop/). I have rewritten the post to clarify more.