Support » Plugins » Dynamic Content in Non WP file

  • Resolved buffalokill


    The Setup

    I’m messing around with a ajax technique of dynamically loading content from some includes in my theme directory, based on the content inside of a div#panel

    so i have these includes in my theme directory.


    In the header.php template I have list of direct links to these files.

    The list of links beneath the div#panel in the header template will dynamically load the content from each of those includes when clicked directly into the div#panel in the header file.

    So as i click the search icon, the search box will load up top. As i click the subscribe icon, the feed info will swap out in place of the search box, etc.

    The Problem

    The content being loaded isn’t connected with WP, so template tags are not working.

    The Question

    Is there some code that I can throw into the include files, so that they’ll be considered by WP as part of the template? Maybe something I can throw into my functions.php file?

    The Markup

    <div id="panel">
        <div>Default Panel</div>
      </div> <!--/panel-->
      <div id="nav">
          <li class="btn-pages"><a href="<?php bloginfo('stylesheet_directory'); ?>/includes/pages.php">Pages</a></li>
          <li class="btn-archives"><a href="<?php bloginfo('stylesheet_directory'); ?>/includes/archives.php">Archives</a></li>
          <li class="btn-search"><a href="<?php bloginfo('stylesheet_directory'); ?>/includes/search.php">Search</a></li>
          <li class="btn-subscribe"><a href="<?php bloginfo('stylesheet_directory'); ?>/includes/subscribe.php">Subscribe</a></li>
Viewing 1 replies (of 1 total)
  • buffalokill


    To answer this question for anyone else. You just need to place this code on top of the file that you want to initiate the wordpress system.

    <?php require('../../../../wp-blog-header.php'); ?>

    Or this may work as well…

    <?php require(ABSPATH . '/wp-blog-header.php'); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic Content in Non WP file’ is closed to new replies.