title: jQuery UI Accordion only works for first post: WordPress Custom Post Type
body: <p>Accordion only works for first post... </p>
  
  <p>I know there are similar questions already posted, and after reading through all of them I can't seem to figure out why mine is not working.  </p>
  
  <p>I am enqueuing the script in functions.php like so:</p>
  
  <pre><code>function my_scripts_method() {
      if ( !is_admin() ) {
          wp_enqueue_script('jquery-ui-accordion');
          wp_enqueue_script(
              'custom-accordion',
          get_template_directory_uri() . '/js/accordion.js',
          array('jquery')
      );
      }
  }
  add_action('wp_enqueue_scripts', 'my_scripts_method');
  </code></pre>
  
  <p>The .js file is like so: </p>
  
  <pre><code>jQuery(document).ready(function($) {
      $( "#accordion" ).accordion({
          collapsible: true, 
                  active: false
      });
  });
  </code></pre>
  
  <p>The custom post type loop is like so: </p>
  
  <pre><code>&lt;?php while ( have_posts() ) : the_post(); ?&gt;
  
  &lt;div id="accordion"&gt; 
  
      &lt;h3&gt;&lt;?php the_title(); ?&gt;&lt;/h3&gt; 
  
      &lt;div&gt;
      &lt;?php the_content(); ?&gt;
      &lt;/div&gt;
  
  &lt;/div&gt; &lt;!--#accordion--&gt;
  
  &lt;?php endwhile; ?&gt;
  </code></pre>
  
  <p>The accordion only works for the first post... </p>
  
  <p>Any ideas why?  </p>
  
  <p>URL in question: premierdev1 (dot) hcg (dot) bz/prm_faq/</p>