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 have some links which load the page content of the page they reference to inside a Fancybox popup(pages like "shipping" or "returns", mainly text content).

I would create the pages an then I will add the permalinks to these pages to other sections, like footer or sidebar, and they will open in the popup window.

Have you come across anything like that? What would be the best way to implement it??

Any suggestion will be greatly appreciated.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I have found that the best way to include WordPress pages into a fancybox is to create a new template to use for those pages. For example I have some of my contact forms in a fancy box and the template I use is called custom-page-plain.php and doesn't call header.php and contains a link to an alternate style sheet.

<?php
 /*
 Template Name: plain page
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <meta name="MSSmartTagsPreventParsing" content="true" />
  <meta http-equiv="Imagetoolbar" content="No" />
  <title>My Form Title</title>
  <link rel="stylesheet" href="http://xxxxxxx.com/wp-content/themes/revision3/stylemin2.css?rev=676777" type="text/css" media="screen,projection" />
  <?php wp_head(); ?>
  </head>
<body>
  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  <?php the_content('read more'); ?>
  <?php endwhile; endif; ?>
  <?php wp_footer(); ?>
</body>
</html>

As you can see the template contains the the wp_head and wp_footer calls directly in the template.

Whenever I want to create a page to go in a fancybox I just choose my plain template then add the fancybox class to the link.

share|improve this answer
    
Nice solution! Thank you. –  Mirko Jan 26 '11 at 12:02
    
+1 Creative way to solve the problem. –  gearsdigital Jun 9 '11 at 4:55

Well best option in my opinion is hardcoding the contents of the boxes and just putting the divs in the footer. Hassle if you've got a client wanting to edit via WordPress. Next option is to get the page contents for each of these in the footer for each div. Kinda wasteful. Next option, most likely what you're looking for is adding an action into wp_loaded and handling the request there by hand and then kill the process.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.