Changeset 1541427
- Timestamp:
- 11/27/2016 05:23:14 PM (8 years ago)
- Location:
- mhshohel-faq
- Files:
-
- 4 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mhshohel-faq/trunk/mhshohel-faq.php
r844648 r1541427 4 4 * Plugin URI: http://wordpress.org/plugins/mhshohel-faq 5 5 * Description: A brief description of the Plugin. 6 * Version: 1. 16 * Version: 1. 7 7 * Author: mhshohel 8 8 * Author URI: http://facebook.com/mhshohel1 9 9 */ 10 11 10 11 12 12 function mhshohel_faq_query($atts,$content=null){ 13 14 extract(shortcode_atts(array("limit" => '', 'order'=>'','category'=>''), $atts));15 13 14 extract(shortcode_atts(array("limit" => '', 'order'=>'','category'=>''), $atts)); 15 16 16 // Define limit 17 if( $limit ) { 18 $posts_per_page = $limit; 17 if( $limit ) { 18 $posts_per_page = $limit; 19 19 } else { 20 20 $posts_per_page = '-1'; 21 21 } 22 22 23 23 ob_start(); 24 25 $query = new WP_Query( array ( 26 27 28 29 30 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 34 34 $post_count = $query->post_count; 35 35 36 36 if( $post_count > 0) : 37 37 38 echo '<div id="accordion">';39 $icount=0;38 echo '<div id="accordion">'; 39 $icount=0; 40 40 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 53 52 endwhile; 54 echo '</div>';53 55 54 endif; 56 55 wp_reset_query(); 57 56 58 57 return ob_get_clean(); 59 58 } … … 70 69 71 70 function mhshohel_faqs_script(){ 72 73 74 75 76 77 } 71 if(!is_admin()){ 72 wp_enqueue_script('jquery'); 73 wp_enqueue_script('jquery-ui-core'); 74 wp_register_script('mhshohel_faqs_js', plugins_url('/asset/js/faq-accordion.js', __FILE__ ), array('jquery-ui-accordion'),true); 75 wp_enqueue_script('mhshohel_faqs_js'); 76 } 78 77 } 79 78 add_action( 'init', 'mhshohel_faqs_script'); … … 81 80 82 81 function jquery_accordian_selector() { 83 ?>82 ?> 84 83 85 <script type="text/javascript" >86 var $faqaccordion = jQuery.noConflict();87 $faqaccordion(function() {88 $faqaccordion( "#accordion" ).accordion({89 collapsible: true,90 active: 50000091 <?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 <?php84 <script type="text/javascript" > 85 var $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 100 99 } 101 100 102 101 add_action( 'wp_footer', 'jquery_accordian_selector' ); 103 102 104 if(get_option('load_place')=='wp_head'){ add_action( 'wp_head', 'jquery_accordian_selector' );} 103 if(get_option('load_place')=='wp_head'){ add_action( 'wp_head', 'jquery_accordian_selector' );} 105 104 else{ add_action( 'wp_footer', 'jquery_accordian_selector' );} 106 105 … … 108 107 109 108 110 function mhshohel_faqs_css(){ 111 echo '<style type="text/css">';112 echo get_option('faq_acc_custom_css');113 echo '</style>';109 function mhshohel_faqs_css(){ 110 echo '<style type="text/css">'; 111 echo get_option('faq_acc_custom_css'); 112 echo '</style>'; 114 113 } 115 114 116 115 add_action('wp_head', 'mhshohel_faqs_css'); 117 116 118 117 function mhshohel_faqs_settings( $links ) 119 118 { 120 $links[] = '<a href="admin.php?page=mhshohel-faq/settings_panel.php">Settings</a>';121 return $links;119 ">Settings</a>'; 120 return $links; 122 121 } 123 124 122 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'mhshohel_faqs_settings' ); 125 126 127 123 128 124 require_once('settings_panel.php'); 129 125 130 126 /** 127 * Set some activation hook 128 */ 129 function 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 } 139 register_activation_hook( __FILE__, 'mhshohel_faq_activation' ); -
mhshohel-faq/trunk/readme.txt
r844650 r1541427 1 1 === Plugin Name === 2 3 2 Contributors: mhshohel 4 Tags: accordionfaq, faq, jquery accordion, shortcode faq, custom post 3 Tags: accordionfaq, faq, jquery accordion, shortcode faq, custom post 5 4 Requires at least: 3.0.1 6 Tested up to: 3.87 Stable tag: 4. 35 Tested up to: 6 Stable tag: 4. 8 7 License: GPLv2 or later 9 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 56 55 57 56 58 1. Add Faqs Screenshort `/assets/screenshot-1.png`57 1. 59 58 60 59 … … 68 67 == Changelog == 69 68 69 70 71 70 72 = 1.1 = 71 73 * ducumetation code updated
Note: See TracChangeset
for help on using the changeset viewer.