Advertisement
lberelson

jQuery Accordion WP - template using accordion

Sep 11th, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <!-- attempt static iteration -->
  2. <div id="accordion">
  3. <h3><a href="#">First header</a></h3>
  4.     <div>Content 1 default as collapsed</div>
  5. <h3><a href="#">Second header</a></h3>
  6.     <div>Content 2 default as collapsed</div>
  7. </div>
  8.  
  9.  
  10. <!-- method 1 -->
  11. <div id="accordion">
  12. <?php
  13. $args=array(
  14.   'orderby' => 'name',
  15.   'order' => 'ASC',
  16.   'hide_empty' => FALSE, //important or will not display at all since some cats may have no posts
  17.   'child_of' => 4,
  18.   'display' => 'linear'
  19.   );
  20. $categories=get_categories($args);
  21.   foreach($categories as $category) {
  22.     echo ' <a href="#">' . $category->name.'</a>';
  23.   }
  24. ?>
  25.  
  26.  
  27. <!-- method 2 -->
  28. <?php $categories = get_categories('hide_empty=0&orderby=name&title_li=&child_of=4'); foreach ($categories as $cat) { ?>
  29.     <dt><a href="#"<?php if ($cat->slug == 'photos') {?> class="customer-acquisitiontop" <?php } else {?>class="customer-acquisitiontop" <?php }?>id="<?php echo $cat->slug; ?>" data-filter=".<?php echo $cat->slug; ?>"><h2><?= $cat->cat_name; ?></h2></a></dt>
  30.     <dd class=" ">
  31.         <ul class="row">
  32.             <li class="<?php echo $cat->slug; ?>">
  33.             </li>
  34.         </ul>
  35.     </dd>
  36.     <?php
  37. }
  38. ?>
  39.  
  40. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement