Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: FAQ
- * This is a page for displaying the incsub wpmu dev support plugin on the front-end
- */
- get_header(); // Loads the header.php template
- $faq_categories = incsub_support_get_faq_categories();
- foreach ( $faq_categories as $key => $item ) {
- $faq_categories[ $key ]->faqs = incsub_support_count_faqs_on_category( $item->cat_id );
- $faq_categories[ $key ]->answers = incsub_support_get_faqs( array( 'category' => $item->cat_id ) );
- }
- function embed_media( $match ) {
- require_once( ABSPATH . WPINC . '/class-oembed.php' );
- $wp_oembed = _wp_oembed_get_object();
- $embed_code = $wp_oembed->get_html( $match[1] );
- return $embed_code;
- }
- $half_of_array = ceil( count( $faq_categories ) / 2 );
- ?>
- <style>
- .accordion ul li {
- list-style: disc;
- margin-left:25px;
- }
- #faq-categories .faq-categories-column:first-child {
- width: 36%;
- }
- #faq-categories .faq-categories-column {
- width: 32%;
- min-width: 200px;
- float: left;
- }
- .faq-question-title {
- cursor:pointer;
- background:none;
- font-size:15px;
- font-weight:normal;
- }
- </style>
- <div id="content-area">
- <div class="container clearfix fullwidth">
- <div id="main-area">
- <div id="faq-category-details" class="metabox-holder">
- <?php foreach ( $faq_categories as $category ): ?>
- <div id="faq-category-<?php echo $category->cat_id; ?>" class="faq-category-wrap">
- <?php foreach ( $category->answers as $faq ): ?>
- <div class="postbox closed" data-faq-id="<?php echo $faq->faq_id; ?>">
- <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"><br></div>
- <h3 class="hndle"><span><?php echo $faq->question; ?></span></h3>
- <div class="inside">
- <?php
- add_filter( 'the_content', 'wptexturize' );
- add_filter( 'the_content', 'convert_smilies' );
- add_filter( 'the_content', 'convert_chars' );
- add_filter( 'the_content', 'wpautop' );
- add_filter( 'the_content', 'shortcode_unautop' );
- add_filter( 'the_content', 'prepend_attachment' );
- $answer = preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', 'embed_media', $faq->answer );
- $answer = apply_filters( 'the_content', $answer );
- ?>
- <div id="faq-answer-<?php echo $faq->faq_id; ?>">
- <?php echo ( $answer ); ?>
- <p class="submit" data-faq-id="<?php echo $faq->faq_id; ?>">
- <h4><u><?php _e( 'Was this solution helpful?', INCSUB_SUPPORT_LANG_DOMAIN ); ?></u></h4>
- <?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>'; ?>
- <img style="display:none; margin-left:10px;vertical-align:middle" src="<?php echo INCSUB_SUPPORT_ASSETS_URL . 'images/ajax-loader.gif'; ?>">
- </p>
- </div>
- </div>
- </div>
- <?php endforeach; ?>
- </div>
- <?php endforeach; ?>
- </div>
- </div>
- </div>
- </div>
- <script>
- jQuery(document).ready(function($) {
- $('.wrap').support_system();
- });
- </script>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement