Advertisement
firoze

bootstrap according in wordpress

Jan 28th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="col-md-9">
  2.         <?php
  3.         $args = array(
  4.             'post_type' => 'acordion',
  5.             'posts_per_page' => '-1',
  6.             'order' => 'ASC'
  7.         );
  8.         $the_query = new WP_Query($args);
  9.         ?>
  10.         <?php $c = 0; ?>
  11.        
  12.         <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  13.  
  14.             <?php
  15.             if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
  16.                     $c++;
  17.                     ?>
  18.  
  19.                     <div class="panel panel-default">
  20.                         <div class="panel-heading" role="tab" id="heading-<?php the_ID(); ?>">
  21.                             <h4 class="panel-title">
  22.                                 <a data-toggle="collapse" data-parent="#accordion" href="#collapse-<?php the_ID(); ?>" aria-expanded="true" aria-controls="collapse-<?php the_ID(); ?>">
  23.                                     <?php the_title(); ?>
  24.                                 </a>
  25.                             </h4>
  26.                         </div>
  27.  
  28.                         <div id="collapse-<?php the_ID(); ?>" class="panel-collapse collapse <?php if ($c == 1) echo 'in'; ?>" role="tabpanel" aria-labelledby="heading-<?php the_ID(); ?>">
  29.                             <div class="panel-body">
  30.                                 <?php the_excerpt(); ?>
  31.                             </div>
  32.                         </div>
  33.                     </div>
  34.  
  35.  
  36.                     <?php
  37.                 endwhile;
  38.             else:
  39.                 ?>
  40.  
  41.                 <p>Please fill out some questions.</p>
  42.  
  43.             <?php endif; ?>
  44.             <?php wp_reset_postdata(); ?>
  45.         </div>
  46.     </div>
  47.  
  48.  
  49. /****************************post type ***************************************************/
  50.  
  51. function mamun_theme_custom_accordion() {
  52.  
  53.     register_post_type('acordion', array(
  54.         'public' => true,
  55.         'lable' => 'Accordion',
  56.         'labels' => array(
  57.             'name' => 'Accordions',
  58.             'singular_name' => 'Accordion',
  59.             'add_new' => 'Add New Accordion',
  60.         ),
  61.         'supports' => array('title', 'editor', 'excerpt',),
  62.     ));
  63. }
  64.  
  65. add_action('init', 'mamun_theme_custom_accordion');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement