title: How to trigger jquery plugins after ajax has loaded a page in WordPress?
body: <p>After all links in Google search results being purple and me being frustrated since couple of hours I decided to ask you guys to help me with the problem.</p>
  
  <p>On my home page in WordPress, a loop generates list with all posts titles on the blog. To improve website loading time, I decided to go with AJAX. Instead of loading all content at once, you click the title of certain post to display its cotnent below. Simply, when you click it POSTs the id of the post (taken from attribute tag) to the ajax.php file (being WordPress template with a loop to display content ... ). When the content is read out, it gets displayed on the front end.</p>
  
  <p>Problem are plugins. As they are not re-fired after content loads (DOM changes). Obviously, I don't want the solution that I add every single plugin I installed to AJAX callback, because it is not the way it should be. I want it automated. WordPress is meant to be simple and easy to manage (even from developers point of view).</p>
  
  <p>I already tried with live(), livequery() - the plugin, listen() - the plugin .. and tried to change my ajax script to be more the WordPress way (using admin-ajax.php) and everytime result is the same - it doesnt work.</p>
  
  <p>By plugins I mean for example: Syntax Highlighter, Social Share Buttons or FancyBox / Lightbox for images... Even if I add plugin's function to the ajax loop to display it manually it still fails...</p>
  
  <p>I suspect I may use live() functions a bit wrong or something ... anyway this is my code:</p>
  
  <p><strong>Front-end loop (index.php)</strong></p>
  
  <pre><code>&lt;?php while (have_posts()) : the_post(); ?&gt;   
      &lt;article&gt;
          &lt;div class="fake"&gt;
              &lt;div class="header" rel="&lt;?php the_ID(); ?&gt;"&gt;
                  &lt;h1 class="title"&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
                  &lt;span class="tags"&gt;
                      &lt;?php
                        $posttags = get_the_tags();
                        if ($posttags) {
                          foreach($posttags as $tag) {
                            echo $tag-&gt;name . ', '; 
                          }
                        }
                      ?&gt;
                  &lt;/span&gt;
                  &lt;span class="post_no"&gt;#&lt;?=$published?&gt;&lt;/span&gt;
                  &lt;div class="arrow"&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="content"&gt;&lt;/div&gt;
      &lt;/article&gt;
     &lt;?php endwhile; ?&gt;
  </code></pre>
  
  <p><strong>Fragment of AJAX I use:</strong></p>
  
  <pre><code>$('.header').live('click',function() {
          var content = $(this).parent().parent().find('.content');
          var post_id = $(this).attr("rel"); 
          content.load("http://localhost/simpleecode/ajax/",{id:post_id}).delay(800).slideDown('slow');});
  </code></pre>
  
  <p><strong>Template with loop for AJAX:</strong></p>
  
  <pre><code>&lt;?php $post = get_post($_POST['id']); ?&gt;
  &lt;?php if ($post) : ?&gt;
  &lt;?php setup_postdata($post); ?&gt;
  &lt;?php the_content(); ?&gt;
  &lt;?php endif;?&gt;
  </code></pre>
  
  <p>I think you may like link to the dev website to check out the DOM and files for your own too (I used shortlink because it is dev site and I don't want it to be public anyhow):</p>
  
  <p><a href="http://bit.ly/Oa6hWH" rel="nofollow">http://bit.ly/Oa6hWH</a></p>
  
  <p>Hope you will have idea on how to do this :S</p>