plugin_name = $name; $this->plugin_version = $ver; $this->post_type_name = 'adonide_faq'; $this->faqPage_plugin_get_signature(); add_action('init',array(&$this,'faqPage_init_language')); add_action('init',array(&$this,'add_faqPage_button')); add_action('init',array(&$this,'faqPage_postBuild')); add_action('wp_enqueue_scripts',array(&$this,'faqPage_css')); add_action('wp_enqueue_scripts',array(&$this,'faqPage_js')); add_action('admin_enqueue_scripts',array(&$this,'faqPage_admin')); add_action('init',array(&$this,'faqPage_buildTaxonomy')); add_shortcode('faq', array($this, 'faqPage_short_code')); } /** @ ------------------------------------------------------ @ Front CSS @ ------------------------------------------------------ **/ function add_faqPage_button() { if(!current_user_can('edit_posts') && ! current_user_can('edit_pages')){ return; } if(get_user_option('rich_editing') == 'true'){ add_filter('mce_external_plugins', 'add_faqPage_tinymce_plugin'); add_filter('mce_buttons', 'register_faqPage_button'); } function register_faqPage_button($buttons) { array_push($buttons, "|", "faqPage_button"); return $buttons; } function add_faqPage_tinymce_plugin($plugin_array) { $plugin_array['faqPage_button'] = plugins_url('js/faqPage.js', __FILE__); return $plugin_array; } function faqPage_refresh_mce($ver) { $ver += 3; return $ver; } add_filter( 'tiny_mce_version', 'faqPage_refresh_mce'); } /** @ ------------------------------------------------------ @ Front CSS @ ------------------------------------------------------ **/ public function faqPage_css(){ wp_enqueue_style( 'faqPage-style', plugins_url('css/faqPage_front.css', __FILE__) ); } /** @ ------------------------------------------------------ @ Front JS @ ------------------------------------------------------ **/ public function faqPage_js(){ wp_enqueue_script( 'faqPage-jq', plugins_url('js/jquery.js', __FILE__) ); wp_enqueue_script( 'faqPage-js', plugins_url('js/faqPage_front.js', __FILE__) ); } /** @ ------------------------------------------------------ @ Front Admin JS @ ------------------------------------------------------ **/ public function faqPage_admin(){ wp_enqueue_script( 'faqPage-admin', plugins_url('js/faqPage_front_admin.js', __FILE__) ); } /** @ ------------------------------------------------------ @ Short Code @ ------------------------------------------------------ **/ public function faqPage_short_code($atts){ $cat = $atts['catid']; // echo 'catId = '.$catId; ?>
'adonide_faq', 'orderby' => 'menu_order', 'order' => 'ASC' ); if(isset($cat) AND $cat!='cat'){ $args['tax_query'] = array( array( 'taxonomy' => 'taxonomies', 'field' => 'term_id', 'terms' => $cat ) ); } $my_query = new WP_Query($args); if($my_query->have_posts()){ $i=1; $adonide_faq = ''; while($my_query->have_posts()){ $my_query->the_post(); $custom = get_post_custom(get_the_ID()); $adonide_faq .= '
  • '.get_the_title().'
    '.get_the_content().'
  • '; $i++; } } wp_reset_postdata(); return $adonide_faq; ?>
    post_type_name, array( 'labels' => array( 'name' => __( 'Questions', 'html-faq-page' ), 'singular_name' => __( 'Question', 'html-faq-page' ), 'add_new' => __( 'Nouvelle Question', 'html-faq-page' ), 'add_new_item' => __( 'Ajouter une nouvelle Question', 'html-faq-page' ), 'edit_item' => __( 'Modification', 'html-faq-page' ), 'new_item' => __( 'Nouvelle Question ', 'html-faq-page' ), 'all_items' => __( 'Toutes les Questions', 'html-faq-page' ), 'view_item' => __( 'Afficher les Questions', 'html-faq-page' ), 'search_items' => __( 'Recherche', 'html-faq-page' ), 'not_found' => __( 'Aucune Question n'a été trouvée', 'html-faq-page'), 'not_found_in_trash' => __( 'Aucune Question n'a été trouvée dans le corbeille', 'html-faq-page'), 'parent_item_colon' => '', 'menu_name' => __( 'Questions', 'html-faq-page') ), 'public' => true, 'menu_position' => 15, 'rewrite' => array('slug' => '/adonide/faq'), 'supports' => array( 'title', 'editor', 'author', 'comments', 'thumbnail', 'excerpt', 'custom-fields' ), 'taxonomies' => array( '' ), 'menu_icon' => plugins_url( 'images/icon.png', __FILE__ ), 'has_archive' => true ) ); add_action('admin_menu',array(&$this,'faqPage_addSubmenu')); } /*************************************************************** @ @ HTML FAQ PAGE sub menu @ /**************************************************************/ public function faqPage_addSubmenu(){ add_submenu_page('edit.php?post_type=adonide_faq', __('Aide', 'html-faq-page') , __('Aide', 'html-faq-page') , 'manage_options', __FILE__, array(&$this,'help_configPage')); } /*************************************************************** @ @ Taxonomy @ /**************************************************************/ public function faqPage_buildTaxonomy(){ register_taxonomy( __('taxonomies', 'html-faq-page'), strtolower($this->post_type_name), array( 'hierarchical' => true, 'label' => __('Taxonomies', 'html-faq-page'), 'query_var' => true, 'rewrite' => array( 'slug' => ''.strtolower($this->post_type_name).'-taxonomies' ) ) ); } /*************************************************************** @ @ HTML FAQ PAGE sub menu @ /**************************************************************/ public function help_configPage(){ ?>

    plugin_name .' '.$this->plugin_version; ?>

    1. [faq catId=2]
    2. !

    0){ ?>
    name;?> $this->post_type_name, 'orderby' => 'menu_order', 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => 'taxonomies', 'field' => 'term_id', 'terms' => $term->term_id ) ) ); // print_r($args); $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) { ?>
      have_posts() ) { $my_query->the_post(); ?>