Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to generate dynamic pages based on a third-party API. However, I'm not sure where in the WP loop to capture the request and generate the content. For example, if a user is requesting a page at

http://mydomain.com/events/june-2

I would like to detect that they are requesting an event page by looking at the URL slug, then using the final piece, "june-2", to make a request to the third-party API and use the data to generate a page. Unfortunately, I can't figure out where to place it before a 404 is generated. I have tried the theme's index.php and page.php files. Would it better to do this with URL rewriting?

Any thoughts?

share|improve this question
    
This might be helpful - coderwall.com/p/fwea7g. –  Shazzad May 27 at 22:09
    
Search this site for "Endpoint". –  s_ha_dum May 28 at 0:42
    
Sorry, neither of these really helped. The first link doesn't really account for theming or 404 errors, and the second comment is just vague. –  Mark Jun 4 at 23:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.