Advertisement
Guest User

WPMU DEV INCSUB SUPPORT FAQ FRONTEND

a guest
Feb 7th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.31 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: FAQ
  4.  * This is a page for displaying the incsub wpmu dev support plugin on the front-end
  5.  */
  6.  
  7. get_header(); // Loads the header.php template
  8.  
  9. $faq_categories = incsub_support_get_faq_categories();
  10.  
  11. foreach ( $faq_categories as $key => $item ) {
  12.     $faq_categories[ $key ]->faqs = incsub_support_count_faqs_on_category( $item->cat_id );
  13.     $faq_categories[ $key ]->answers = incsub_support_get_faqs( array( 'category' => $item->cat_id ) );
  14. }
  15.  
  16. function embed_media( $match ) {
  17.     require_once( ABSPATH . WPINC . '/class-oembed.php' );
  18.     $wp_oembed = _wp_oembed_get_object();
  19.  
  20.     $embed_code = $wp_oembed->get_html( $match[1] );
  21.     return $embed_code;
  22. }
  23.  
  24. $half_of_array = ceil( count( $faq_categories ) / 2 );
  25.  
  26. ?>
  27.  
  28. <style>
  29.     .accordion ul li {
  30.         list-style: disc;
  31.         margin-left:25px;
  32.     }
  33.     #faq-categories .faq-categories-column:first-child {
  34.         width: 36%;
  35.     }
  36.     #faq-categories .faq-categories-column {
  37.         width: 32%;
  38.         min-width: 200px;
  39.         float: left;
  40.     }
  41.     .faq-question-title {
  42.         cursor:pointer;
  43.         background:none;
  44.         font-size:15px;
  45.         font-weight:normal;
  46.     }
  47. </style>
  48.  
  49. <div id="content-area">
  50.     <div class="container clearfix fullwidth">
  51.         <div id="main-area">
  52.  
  53.             <div id="faq-category-details" class="metabox-holder">
  54.                 <?php foreach ( $faq_categories as $category ): ?>
  55.                     <div id="faq-category-<?php echo $category->cat_id; ?>" class="faq-category-wrap">
  56.                         <?php foreach ( $category->answers as $faq ): ?>
  57.                             <div class="postbox closed" data-faq-id="<?php echo $faq->faq_id; ?>">
  58.                                 <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"><br></div>
  59.                                 <h3 class="hndle"><span><?php echo $faq->question; ?></span></h3>
  60.                                 <div class="inside">
  61.                                     <?php
  62.                                         add_filter( 'the_content', 'wptexturize'        );
  63.                                         add_filter( 'the_content', 'convert_smilies'    );
  64.                                         add_filter( 'the_content', 'convert_chars'      );
  65.                                         add_filter( 'the_content', 'wpautop'            );
  66.                                         add_filter( 'the_content', 'shortcode_unautop'  );
  67.                                         add_filter( 'the_content', 'prepend_attachment' );
  68.  
  69.                                         $answer = preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', 'embed_media', $faq->answer );
  70.                                         $answer = apply_filters( 'the_content', $answer );
  71.                                     ?>
  72.  
  73.                                     <div id="faq-answer-<?php echo $faq->faq_id; ?>">
  74.                                         <?php echo ( $answer ); ?>
  75.                                         <p class="submit" data-faq-id="<?php echo $faq->faq_id; ?>">
  76.                                             <h4><u><?php _e( 'Was this solution helpful?', INCSUB_SUPPORT_LANG_DOMAIN ); ?></u></h4>
  77.                                             <?php echo '<button class="button-primary vote-button" data-faq-id="' . $faq->faq_id . '" data-vote="yes"> ' . __( 'Yes', INCSUB_SUPPORT_LANG_DOMAIN ) . '</button> <button href="#" class="button vote-button" data-faq-id="' . $faq->faq_id . '" data-vote="no"> ' . __( 'No', INCSUB_SUPPORT_LANG_DOMAIN ) . '</button>'; ?>
  78.                                             <img style="display:none; margin-left:10px;vertical-align:middle" src="<?php echo INCSUB_SUPPORT_ASSETS_URL . 'images/ajax-loader.gif'; ?>">
  79.                                         </p>
  80.                                     </div>
  81.                                 </div>
  82.                             </div>
  83.                         <?php endforeach; ?>
  84.                     </div>
  85.                 <?php endforeach; ?>
  86.             </div>
  87.  
  88.         </div>
  89.     </div>
  90. </div>
  91.  
  92. <script>
  93.     jQuery(document).ready(function($) {
  94.         $('.wrap').support_system();
  95.     });
  96. </script>
  97.  
  98. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement