Plugin Directory

Changeset 1541427

Timestamp:
11/27/2016 05:23:14 PM (8 years ago)
Author:
mhshohel
Message:

Updated banner, fixed some bug, performance improved, updated after a long time

Location:
mhshohel-faq
Files:
4 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • mhshohel-faq/trunk/mhshohel-faq.php

    r844648 r1541427  
    44 * Plugin URI: http://wordpress.org/plugins/mhshohel-faq
    55 * Description: A brief description of the Plugin.
    6  * Version: 1.1
     6 * Version: 1.
    77 * Author: mhshohel
    88 * Author URI: http://facebook.com/mhshohel1
    99 */
    10  
    11  
     10
     11
    1212function mhshohel_faq_query($atts,$content=null){
    13    
    14 extract(shortcode_atts(array("limit" => '', 'order'=>'','category'=>''), $atts));
    15    
     13
     14extract(shortcode_atts(array("limit" => '', 'order'=>'','category'=>''), $atts));
     15
    1616    // Define limit
    17     if( $limit ) { 
    18         $posts_per_page = $limit; 
     17    if( $limit ) {
     18        $posts_per_page = $limit;
    1919    } else {
    2020        $posts_per_page = '-1';
    2121    }
    22    
     22
    2323    ob_start();
    24                
    25     $query = new WP_Query( array ( 
    26                                 'post_type'      => 'faq',
    27                                 'posts_per_page' => $posts_per_page,
    28                                 'cat'           => $category,
    29                                 'order'          => $order,
    30                                 'no_found_rows'  => 1
    31                                 )
    32                         );
    33    
     24
     25    $query = new WP_Query( array (
     26            'post_type'      => 'faq',
     27            'posts_per_page' => $posts_per_page,
     28            'cat'           => $category,
     29            'order'          => $order,
     30            'no_found_rows'  => 1
     31       
     32    );
     33
    3434    $post_count = $query->post_count;
    35    
     35
    3636    if( $post_count > 0) :
    3737
    38     echo '<div id="accordion">';
    39     $icount=0;
     38    echo '<div id="accordion">';
     39    $icount=0;
    4040        while ($query->have_posts()) : $query->the_post(); $icount++;
    41         ?>
    42        
    43         <h3><?php if(get_option('faq_custom_text') !=''){ echo get_option('faq_custom_text');} ?>
    44         <?php if(get_option('count')=='count_show'){echo $icount.'.';} ?>
    45          <?php the_title(); ?>
    46          </h3>
    47          
    48         <div>
    49         <p><?php echo get_the_content(); ?></p>
    50         </div>
    51         <?php
    52         $i++;
     41            ?>
     42
     43            <h3><?php if(get_option('faq_custom_text') !=''){ echo get_option('faq_custom_text');} ?>
     44                <?php if(get_option('count')=='count_show'){echo $icount.'.';} ?>
     45                <?php the_title(); ?>
     46            </h3>
     47
     48            <div>
     49                <p><?php echo get_the_content(); ?></p>
     50            </div>
     51            <?php
    5352        endwhile;
    54     echo '</div>'; 
     53   
    5554    endif;
    5655    wp_reset_query();
    57    
     56
    5857    return ob_get_clean();
    5958}
     
    7069
    7170function mhshohel_faqs_script(){
    72      if(!is_admin()){
    73         wp_enqueue_script('jquery');
    74         wp_enqueue_script('jquery-ui-core');
    75         wp_register_script('mhshohel_faqs_js', plugins_url('/asset/js/faq-accordion.js', __FILE__ ), array('jquery-ui-accordion'),true);
    76         wp_enqueue_script('mhshohel_faqs_js');
    77     }   
     71if(!is_admin()){
     72wp_enqueue_script('jquery');
     73wp_enqueue_script('jquery-ui-core');
     74wp_register_script('mhshohel_faqs_js', plugins_url('/asset/js/faq-accordion.js', __FILE__ ), array('jquery-ui-accordion'),true);
     75wp_enqueue_script('mhshohel_faqs_js');
     76    }
    7877}
    7978add_action( 'init', 'mhshohel_faqs_script');
     
    8180
    8281function jquery_accordian_selector() {
    83 ?>
     82?>
    8483
    85 <script type="text/javascript" >
    86 var $faqaccordion = jQuery.noConflict();
    87     $faqaccordion(function() {
    88     $faqaccordion( "#accordion" ).accordion({
    89     collapsible: true,
    90     active: 500000
    91     <?php if(get_option('icon_style')=='icon_plus'){echo ', icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }';}
    92     elseif(get_option('icon_style')=='icon_arrow'){echo ', icons: {  header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }';}
    93     elseif(get_option('icon_style')=='icon_null'){echo ', icons: null';}
    94     ?>
    95    
    96     });
    97     });
    98 </script>
    99 <?php
     84<script type="text/javascript" >
     85var $faqaccordion = jQuery.noConflict();
     86    $faqaccordion(function() {
     87    $faqaccordion( "#accordion" ).accordion({
     88    collapsible: true,
     89    active: 500000
     90    <?php if(get_option('icon_style')=='icon_plus'){echo ', icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }';}
     91   
     92    elseif(get_option('icon_style')=='icon_null'){echo ', icons: null';}
     93    ?>
     94
     95    });
     96    });
     97</script>
     98<?php
    10099}
    101100
    102101add_action( 'wp_footer', 'jquery_accordian_selector' );
    103102
    104 if(get_option('load_place')=='wp_head'){ add_action( 'wp_head', 'jquery_accordian_selector' );} 
     103if(get_option('load_place')=='wp_head'){ add_action( 'wp_head', 'jquery_accordian_selector' );}
    105104else{ add_action( 'wp_footer', 'jquery_accordian_selector' );}
    106105
     
    108107
    109108
    110 function mhshohel_faqs_css(){ 
    111 echo '<style type="text/css">';
    112 echo get_option('faq_acc_custom_css');
    113 echo '</style>';
     109function mhshohel_faqs_css(){
     110echo '<style type="text/css">';
     111echo get_option('faq_acc_custom_css');
     112echo '</style>';
    114113}
    115114
    116     add_action('wp_head', 'mhshohel_faqs_css');
     115add_action('wp_head', 'mhshohel_faqs_css');
    117116
    118  function mhshohel_faqs_settings( $links )
     117function mhshohel_faqs_settings( $links )
    119118{
    120 $links[] = '<a href="admin.php?page=mhshohel-faq/settings_panel.php">Settings</a>';
    121 return $links;
     119">Settings</a>';
     120return $links;
    122121}
    123 
    124122add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'mhshohel_faqs_settings' );
    125 
    126 
    127123
    128124require_once('settings_panel.php');
    129125
    130 
     126/**
     127 * Set some activation hook
     128 */
     129function mhshohel_faq_activation() {
     130    $is_activated = get_option('is_mhshohel_faq_activated');
     131    if ( ! $is_activated){
     132        update_option('is_mhshohel_faq_activated', true);
     133        update_option('load_place', 'wp_head');
     134        update_option('faq_acc_custom_css', '');
     135        update_option('icon_style', 'icon_arrow');
     136        update_option('count', 'count_show');
     137    }
     138}
     139register_activation_hook( __FILE__, 'mhshohel_faq_activation' );
  • mhshohel-faq/trunk/readme.txt

    r844650 r1541427  
    11=== Plugin Name ===
    2 
    32Contributors: mhshohel
    4 Tags: accordionfaq, faq, jquery accordion, shortcode faq, custom post
     3Tags: accordionfaq, faq, jquery accordion, shortcode faq, custom post
    54Requires at least: 3.0.1
    6 Tested up to: 3.8
    7 Stable tag: 4.3
     5Tested up to:
     6Stable tag: 4.
    87License: GPLv2 or later
    98License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5655
    5756
    58 1.  Add Faqs Screenshort `/assets/screenshot-1.png`
     571.
    5958
    6059
     
    6867== Changelog ==
    6968
     69
     70
     71
    7072= 1.1 =
    7173* ducumetation code updated
Note: See TracChangeset for help on using the changeset viewer.