Routing dynamic numeric slug to custom template
How do I make WordPress use a template for any requests where the url is /careers/[0-9]+
?
We used to have custom posts for job openings handled by single-jobs.php
– then switched to an Applicant Tracking System with a nice REST API, meaning no more job posts in the data base on our end.
I considered making a single job page with an id parameter (bla.com/careers/job?id=123
). A page-job.php
template would then read the parameter and use to request data from the API and then echo a page accordingly.
But for SEO reasons, I want the routing to have “proper” slugs such as bla.com/careers/123
.
Would I need to basically do what I suggested above except use JavaScript to change/fake what the url looks like, or is there a backend way of doing that?
How do I make that happen?
Leave an answer