根据其他帖子,我正在尝试为我的养鱼网站制作一个定制的WordPress安装作为CMS。
在我的一个自定义帖子类型上(species
, 显示给定鱼类种类的信息)根本不使用标准的“Post”编辑器,而是在元框中有许多字段,如“属”、“种”、“饮食”、“兼容性”等。
因此,使用WordPress的内置TinyMCE安装有些麻烦。然而,最终我还是让它“起作用”(见答案here).
那是几个月前的事了,我忘了它从来没有100%正常工作过:界面会出错,并在400px的文本区域上显示200px的工具栏宽度。我认为这是因为页面上有多个不同宽度的工具栏实例(我在初始化TinyMCE时从未强制使用宽度)。
我现在正试图注销TinyMCE的默认WordPress安装,以便根据AndrewJackman在中的帖子使用TinyMCE jQuery包this 线
-> the plugin file
wp_register_script(\'tinymce-external\', $this->plugin_url .\'tiny_mce/jquery.tinymce.js\', array(\'jquery\'));
wp_enqueue_script(\'tinymce-external\');
wp_register_script(\'tinymce-external-config\', $this->plugin_url .\'js/tinymce-config.js\', array(\'tinymce-external\'));
wp_enqueue_script(\'tinymce-external-config\');
-> tinymce-external-config.js
jQuery().ready(function() {
jQuery(\'.editor_ui\').tinymce({
// Location of TinyMCE script
// ---> THIS LINE NEEDS TO BE CHANGED IF THE PLUGIN RENAMES
script_url : \'/dev/wp-content/plugins/sf-species-profiles/tiny_mce/tiny_mce.js\',
// General options
theme : "advanced",
skin : "wp_theme",
language : "en",
plugins:"tabfocus,spellchecker",
tab_focus : \':prev,:next\',
theme_advanced_layout_manager : "SimpleLayout",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1 : "bold,italic,underline,|,bullist,numlist,outdent,indent,blockquote,|,link,unlink,image,removeformat,charmap,spellcheck",
//theme_advanced_buttons2 : "",
//theme_advanced_buttons3 : ""
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
});
});
-> the textarea
<div>
<label>Genus</label>
<p>
<textarea name="genus" class="editor_ui"><?php if(isset($genus[0])) { echo esc_attr( $genus[0] ); } ?></textarea>
<span>Description</span>
</p>
</div>
-> the resultant errors in firebug
"NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/langs/en.js?ver=345-20111127" -> en.js?...0111127
Failed to load: http://www.mywebsite.com/wp-admin//langs/en.js -> jquery...r=1.7.1 (line 2)
"NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/themes/advanced/editor_template.js?ver=345-20111127" -> editor...0111127
Failed to load: http://www.mywebsite.com/wp-admin//themes/advanced/editor_template.js -> jquery...r=1.7.1 (line 2)
"NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/plugins/spellchecker/editor_plugin.js?ver=345-20111127" -> editor...0111127
Failed to load: http://www.mywebsite.com/wp-admin//plugins/spellchecker/editor_plugin.js -> jquery...r=1.7.1 (line 2)
"NetworkError: 404 Not Found - http://www.mywebsite.com/wp-admin/plugins/tabfocus/editor_plugin.js?ver=345-20111127" -> editor...0111127
Failed to load: http://www.mywebsite.com/wp-admin//plugins/tabfocus/editor_plugin.js -> jquery...r=1.7.1 (line 2
看起来它正在试图找到TinyMCE插件和语言文件,但在错误的目录中,我不知道如何更改。这是否是WordPress的兼容性问题;是否需要注销现有的TinyMCE安装?我试过使用
wp_deregister_script(\'tinymce\')
(和tiny\\u mce)但一切都没有改变。
EDIT我使用的是WordPress 3.3,上面提到的都是我创建的自定义帖子类型的管理区域。
提前感谢,