Plugin Directory

Changeset 1041057


Ignore:
Timestamp:
12/09/2014 09:07:04 AM (11 years ago)
Author:
speedito
Message:

Version 2

Location:
simple-faqs/trunk
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • simple-faqs/trunk/readme.txt

    r829004 r1041057  
    33Tags: FAQ listing
    44Requires at least: 3.7.1
    5 Tested up to: 3.8
    6 Stable tag: 1.1.4
     5Tested up to: 4.0.1
     6Stable tag: 2.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313This is a simple plugin to help users put up FAQ lists on their site. Most FAQ plugins only allow a single format (usually the Accordion) format to put up FAQ lists. While that is great there are a number of folks who would rather just have simple bookmark tags to list their Questions at the top and lead to Answers below. This plugin attempts to provide an easy to use solution for such scenarios.
    1414
    15 Options available are:
     15Options for FAQ
    1616<ol>
    1717<li>Accordion (the default option)</li>
     
    1919<li>Bookmarks (show the questions at the top and lead to the related answer below) - now implements scrolling via LocalScroll jQuery plugin</li>
    2020</ol>
     21
     22Also has options for ordering the FAQ and includes 1 pre-built skin with more coming soon
    2123
    2224Details and examples about using the plugin are available at <a href="http://speedsoftsol.com/simple-faq-plugin/" target="_blank">speedsoftsol.com/simple-faq-plugin/</a>
     
    2830
    2931== Frequently Asked Questions ==
     321. What are the different parameters available:
     33style (can be Accordion, Simple, Bookmark)
     34skin (can be none, Dark)
     35order (can be Default, Alpha, Date)
     36category (can be All or any category slug defined in your site)
    3037
     382. Can we use multiple shortcodes on the same page?
     39Yes that is possible since version 2 of the plugin
    3140
    3241
    3342== Changelog ==
     43= 2.0 =
     44Added shortcode generator
     45Now able to have multiple shortcodes on the same page
     46Added new styling skins
     47Multiple ordering options (by order id, publish date or alphabetical)
    3448
    35 = 1.0 =
    36 Initial launch
     49= 1.1.4 =
     50Sort out SVN issue
     51
     52= 1.1.3 =
     53Add smooth scrolling feature for Bookmark Style FAQ
     54
     55= 1.1.2 =
     56Add Back To Top feature for Bookmark Style
     57
     58= 1.1.1
     59Show all FAQ without pagination
    3760
    3861= 1.1 =
    3962Reset Post Data To avoid conflict with Theme Queries
    4063
    41 = 1.1.1
    42 Show all FAQ without pagination
    43 
    44 = 1.1.2 =
    45 Add Back To Top feature for Bookmark Style
    46 
    47 = 1.1.3 =
    48 Add smooth scrolling feature for Bookmark Style FAQ
    49 
    50 = 1.1.4 =
    51 Sort out SVN issue
     64= 1.0 =
     65Initial launch
  • simple-faqs/trunk/simple-faq.php

    r1023806 r1041057  
    44 * Plugin URI: http://wordpress.org/plugins/simple-faqs/
    55 * Description: FAQ plugin to allow creating and showing FAQ easily on Wordpress website
    6  * Version: 1.1.5
     6 * Version: 2.0
    77 * Author: Waqas Ahmed
    88 * Author URI: http://speedsoftsol.com
     
    1111
    1212
    13 
     13/** Add new button in TinyMCE Editor and associate a generator **/
     14add_action('admin_head', 'simple_faq_button');
     15function simple_faq_button() {
     16    add_filter("mce_external_plugins", "simple_faq_add_editor_button_script");
     17    add_filter('mce_buttons', 'simple_faq_button_register');
     18}
     19
     20function simple_faq_add_editor_button_script($plugin_array) {
     21    $plugin_array['simple_faq_button'] = plugins_url( '/simple_faq_button.js', __FILE__ );
     22    return $plugin_array;
     23}
     24
     25function simple_faq_button_register($buttons) {
     26   array_push($buttons, "faq_button");
     27   return $buttons;
     28}
     29
     30function simple_faq_admin_styles() {
     31    wp_enqueue_style('simple-faq-admin', plugins_url('/simple_faq_generator.css', __FILE__));
     32}
     33add_action('admin_enqueue_scripts', 'simple_faq_admin_styles');
     34
     35 
    1436/** Registering the Custom Post Types and the taxonomy at initialization **/
    1537add_action( 'init', 'create_simple_faq_taxonomy', 0 );
     
    4163        'category' => 'all',
    4264        'style' => 'accordion',
     65        'skin' => 'none',
     66        'order' => 'default'
    4367    ), $atts ) );
    4468
    45     $items = get_requested_faqs($category);
     69    $simple_faq_skin = strtolower($skin);
     70    if (isset($simple_faq_skin) && $simple_faq_skin != "none") {
     71        if ($simple_faq_skin == "dark") {
     72            wp_enqueue_style( 'simple-faq-skin', plugins_url( 'skins/dark.css', __FILE__ )  );
     73        }
     74        elseif ($simple_faq_skin == "light") {
     75            wp_enqueue_style( 'simple-faq-skin', plugins_url( 'skins/light.css', __FILE__ )  );
     76        }
     77    }
     78    $items = get_requested_faqs($category, $order);
    4679    switch (strtolower($style)) {
    4780        case "accordion":
    48             add_action ('wp_head', 'initialize_accordion');
    4981            $output = faq_style_accordion($items);
    5082            break;
     
    5688            break;
    5789        default:
    58             add_action ('wp_head', 'initialize_accordion');
    5990            $output = faq_style_accordion($items);
    6091    }
    61     return $output;
     92    return do_shortcode($output);
    6293}
    6394add_shortcode( 'simple-faq', 'render_faqs' );
    6495
    6596
    66 function get_requested_faqs ($parameter) {
    67     if ($parameter == 'all') {
     97// Get all the FAQ you want - and in the correct order
     98function get_requested_faqs ($category, $order) {
     99   
     100    /** Possible order options are
     101        default, name, date
     102    **/
     103    switch (strtolower($order)) {
     104        case "default":
     105            $orderby = 'menu_order';
     106            break;
     107        case "date":
     108            $orderby = 'date';
     109            break;
     110        case "alphabetical":
     111            $orderby = 'name';
     112            break;
     113        default:
     114            $orderby = 'menu_order';
     115    }
     116    $category = strtolower($category);
     117    if ($category == 'all') {
    68118        $args = array (
    69119            'post_type' => 'simple-faqs',
    70             'orderby' => 'menu_order',
     120            'orderby' => $orderby,
    71121            'order' => 'ASC',
    72122            'posts_per_page' => -1
     
    76126        $args = array (
    77127            'post_type' => 'simple-faqs',
    78             'orderby' => 'menu_order',
     128            'orderby' => $orderby,
    79129            'order' => 'ASC',
    80130            'posts_per_page' => -1,
     
    83133                    'taxonomy' => 'faq_category',
    84134                    'field' => 'slug',
    85                     'terms' => $parameter
     135                    'terms' => array($category)
    86136                    )
    87137                )
     
    110160        $output .= '<li class="simple-faq-item simple-faq-number-'.$item_number.'">';
    111161        $output .= '<h3>' . $item['title'] . '</h3>';
    112         $output .= '<br />' . $item['content'] . '</li>';
     162        $output .= $item['content'] . '</li>';
    113163        $item_number++;
    114164    }
     
    146196    }
    147197
    148     $output .= '<div class="simple-faqs-detail">';
     198    $output .= '<div class="simple-faqs-bookmarks">';
    149199    //For the actual FAQ content below
    150200    $item_number = 1; //Reset item counter
     
    168218    echo "<script>
    169219    jQuery(document).ready(function($){
    170         $( '#simple-faq-accordion' ).accordion({
     220        $( '.simple-faq-accordion' ).accordion({
    171221            collapsible: true,
    172222            heightStyle: 'content'
     
    176226
    177227    $item_number = 1;
    178     $output = '<div id="simple-faq-accordion">';
     228    $output = '<div class="simple-faq-accordion">';
    179229    foreach ($items as $item) {
    180230        $output .= '<h3>';
Note: See TracChangeset for help on using the changeset viewer.