<?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');
}
?>
这是我创建的插件,我想问一下为什么firebug产生错误:
TypeError: tinymce.onAddEditor is undefined
当我将tinymce脚本排队并且它无法运行时?
答案 0 :(得分: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');
?>