0

I am using colorbox to load external php files when a modal is triggered. It works great using colorbox's href parameter. I brought it into wordpress only to realize that there are some issues with wordpress and loading via ajax.

When in wordpress, the modal successfully loads, but I want to be able to use wordpress's dynamic tags (bloginfo('template_url'), bloginfo('home'), etc). These will not work in an external page, even if in the theme folder, because wordpress thinks these are just sandard html/php pages outside of wordpress.

How would I enable these pages to work?

Colorbox is simply loading content like so:

$.colorbox({
     href: url
});

On a wordpress page template, I trigger the colorbox like so:

<a href="<?php bloginfo ("template_url"); ?>/lobby.php"> 

I need lobby.php to accept dynamic images and content powered by wordpress. It is still within the theme folder, although its not actually a template. Is this possible? Within each of these external pages, there is no header or footer...just content to load. How can I best go about this?

JCHASE11
  • 3,901
  • 19
  • 69
  • 132
  • If I use php include, wordpress tags work, but I do not want to include, I want to load via ajax through color box. – JCHASE11 Apr 19 '13 at 16:14
  • Are you happy to change `lobby.php` to `require()` some WordPress files? In that case, [this answer](http://stackoverflow.com/questions/5306612/using-wpdb-in-standalone-script/5331944#5331944) might help. As the comment says, just requiring `wp-load.php` should be enough. And if `lobby.php` is in your template directory, you might get away with using a relative path rather than using `$_SERVER['DOCUMENT_ROOT']`. – Hobo Apr 19 '13 at 16:28
  • This worked great, thanks. Can you write an answer so I can accept? – JCHASE11 Apr 19 '13 at 16:47

1 Answers1

0

Seems my comment above answered your question; this answer shows how to include WordPress functionality in a standalone PHP page.

Community
  • 1
  • 1
Hobo
  • 7,536
  • 5
  • 40
  • 50