WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 at 22:09
    
Search this site for "Endpoint". – s_ha_dum May 28 '14 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 '14 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.