• Resolved superpotion

    (@superpotion)


    I see there have been a few people asking how to do this.

    First, Create a page template that you will apply to pages to be displayed in the Thickbox. You new page template should be minimalist, without menus and other extraneous stuff, perhaps showing only the page content. Here’s a really simple one:

    <?php
    /*
    Template Name: Thickbox Page
    */
    ?>
    <div id="thickbox-page">
       <?php if (have_posts()) : while (have_posts()) : the_post();?>
         <div class="post">
    	<h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
    	<div><?php the_content(); ?></div>
         </div>
       <?php endwhile; endif; ?>
    </div>

    Now create a page, say “My New Post”, apply the “Thickbox Page” template and publish.

    From any other page or post, add a link to your new page’s permalink and make sure that you include the thickbox class attribute with the anchor:

    <a href="/my-new-post" class="thickbox">Click here for a page in a popup</a>

    https://www.ads-software.com/extend/plugins/auto-thickbox-plus/

Viewing 3 replies - 1 through 3 (of 3 total)
  • solar345

    (@solar345)

    Hi,

    is there anyway I can use this plugin to display only the content of existing pages. The existing pages have header and footer as they may also be accessed stand alone.

    I want to do something like this https://www.soexcellence.com/nlp-practitioner-certification-one

    The link – click here to read the full endorsement – opens a page that already exists
    https://www.soexcellence.com/john-grinder-endorsement-of-nlp-trainers-antano-and-harini

    but in this case without the header and footer. I had used the plugin colorbox node in drupal to make that happen.
    https://drupal.org/project/colorbox_node

    I am assuming that the same must be possible especially after seeing an option like WordPress Filters (Content, Excerpt, Comments, Widgets) in the settings page. I am assuming there is some method to show only the content of a page.

    If this plugin does not have this feature, please share the name of any other plugin that may have this feature.

    Thanks

    Thread Starter superpotion

    (@superpotion)

    (I’m thinking aloud here…) One way is to use jquery/javascript to check for the existence of the div#TB_window, and and then to hide the header and footer elements if true, something like:

    <script language="javascript">
    $(document).ready( function () {
      hideHeaderAndFooter();
    
      function hideHeaderAndFooter() {
        var hdr = document.getElementById("header");
        var ftr = document.getElementById("footer");
        if($("#TB_window").length != 0) { //it exists
          hdr.innerHTML = "hide";
          ftr.innerHTML = "hide";
        }
      }
    }
    </script>

    I haven’t tested this yet! I’ve just spotted that there are, in fact, 2 ID’s named “header” and 2 named “footer” – so it may not work. We might have to isolate ID “TB_ajaxContent” first… but you get the idea.

    There’s probably a better way of doing it – suggestions are welcome.

    To your last question: I don’t know of a plugin that does this (but it’s highly likely that there is). Perhaps, when you find it, you can let us know.

    Thread Starter superpotion

    (@superpotion)

    Duplicate IDs are a problem – javascript will find only one. We need another approach. Here’s one that’s not very elegant, but it works. Clone the page using this plugin:

    https://www.ads-software.com/extend/plugins/duplicate-post/

    …and apply a different template to the cloned page..

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP Page in a Thickbox’ is closed to new replies.