proper way to add dynamic, db-driven content
-
I have an online store, and basically have thousands of pages ranging from specific product pages to product list pages. I need some help understanding the proper way to add all these pages to wordpress.
To date, the way I’ve handled all these pages is by using hooks for things like status_header and template_redirect. It would be extremely inefficient to go and define a wordpress page for every single page on my site.
My flow looks like this:
(1) an incoming request for a page comes in, and the page is not defined in wordpress.
(2) status_header is called with my hook, and my hook checks the URL for validity and, if the URL matches a regexp, it sets a global variable to define the page type and forces an ignore of is_404(). Otherwise, the page would have thrown a 404.
(3) template_redirect is called, as again, this isn’t a valid wordpress page, despite the fact that I force the ignore of the 404. At this point, my template_redirect hook loads the appropriate template page (i.e. page.php) and then exits gracefully with an exit(0).This is very much a hack. There has to be a better way to handle this. I haven’t been able to find anything about creating large numbers of dynamic pages like this.
I think I have the wrong concept when it comes to handling these types of pages in wordpress, so I could really use some pointers.
Thanks,
Dustin
- The topic ‘proper way to add dynamic, db-driven content’ is closed to new replies.