2014-02-06 29 views
0
<?php 
/* 
Plugin Name: random plug 
Plugin URI: http://example.com/wordpress-plugins/my-plugin 
Description: A plugin demonstrating Cron in WordPress 
Version: 1.0 
Author: Brad Williams 
Author URI: http://wrox.com 
License: GPLv2 
*/ 

add_action('init', 'register_tagging_post'); 

function register_tagging_post(){ 
     $tagging_args = array(
      'public' => true, 
      'supports' => array(
       'title', 
       'thumbnail' 

      ), 
      'query_var' => 'tagging', 
      'rewrite' => array(
       'slug' => 'tagging', 
       'with_front' => false 
      ), 
      'labels' => array(
      'name' => 'Tagge Albums', 
      'singular_name' => 'Album', 
      'add_new' => 'Add New Album', 
      'add_new_item' => 'Add New Album', 
      'edit_item' => 'Edit Album', 
      'new_item' => 'New Album', 
      'view_item' => 'View Album', 
      'search_items' => 'Search Albums', 
      'not_found' => 'No Albums Found', 
      'not_found_in_trash' => 'No Albums Found In Trash' 
     ), 

     ); 

     register_post_type('tagging', $tagging_args); 

     wp_enqueue_script('tinymce123','http://tinymce.cachefly.net/4.0/tinymce.min.js'); 


} 

?> 

這是創造我的插件,我要問,爲什麼螢火蟲產生的錯誤:爲什麼,如果我排隊TinyMCE的腳本,我得到了一個未定義的錯誤

TypeError: tinymce.onAddEditor is undefined 

當我排隊TinyMCE的腳本,它是沒有運作?

回答

0

我相信你初始化函數讓腳本可行,我認爲不是正確的腳本排隊方式。試試下面的一個,讓我知道如果一切正常。 。 。

<?php 
     /* 
     Plugin Name: random plug 
     Plugin URI: http://example.com/wordpress-plugins/my-plugin 
     Description: A plugin demonstrating Cron in WordPress 
     Version: 1.0 
     Author: Brad Williams 
     Author URI: http://wrox.com 
     License: GPLv2 
     */ 

     add_action('init', 'register_tagging_post'); 

     function register_tagging_post(){ 
       $tagging_args = array(
        'public' => true, 
        'supports' => array(
         'title', 
         'thumbnail' 

        ), 
        'query_var' => 'tagging', 
        'rewrite' => array(
         'slug' => 'tagging', 
         'with_front' => false 
        ), 
        'labels' => array(
        'name' => 'Tagge Albums', 
        'singular_name' => 'Album', 
        'add_new' => 'Add New Album', 
        'add_new_item' => 'Add New Album', 
        'edit_item' => 'Edit Album', 
        'new_item' => 'New Album', 
        'view_item' => 'View Album', 
        'search_items' => 'Search Albums', 
        'not_found' => 'No Albums Found', 
        'not_found_in_trash' => 'No Albums Found In Trash' 
       ), 

       ); 

       register_post_type('tagging', $tagging_args); 



     } 
function register_tinymce_script() { 
wp_register_script('tinymce123', 'http://tinymce.cachefly.net/4.0/tinymce.min.js'); 
wp_enqueue_script('tinymce123'); 
} 
add_action('admin_enqueue_scripts','register_tinymce_script'); 

     ?> 
相關問題