我目前正在創建一個簡單的內容管理系統,我真的很喜歡使用編輯器,主要是在我的網站上使用WordPress的圖片上傳器。這可能嗎?我可以在Wordpress網站之外使用Wordpress的編輯器和媒體上傳器嗎?
我知道WordPress使用TinyMCE,他們確實提供一個圖像管理器作爲商業插件,如果這是不可能的,我可能會使用它。
我目前正在創建一個簡單的內容管理系統,我真的很喜歡使用編輯器,主要是在我的網站上使用WordPress的圖片上傳器。這可能嗎?我可以在Wordpress網站之外使用Wordpress的編輯器和媒體上傳器嗎?
我知道WordPress使用TinyMCE,他們確實提供一個圖像管理器作爲商業插件,如果這是不可能的,我可能會使用它。
可以使用WP功能the_editor:
http://codex.wordpress.org/Function_Reference/the_editor
如果你在谷歌上查找該功能,你會發現一堆頁面描述瞭如何將wordpress編輯器插入到插件中。他們提供了許多不同的方式來做你希望尋找的東西。
我使用的是這樣的:
<form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">
<div><h2>Title</h2>
<input type="text" id="title" value="" tabindex="1" name="title" AUTOCOMPLETE=OFF/>
<div>
<h2>Description</h2>
<?php the_editor('', 'description', 'title', true); ?>
</div>
<input type="hidden" name="action" value="post" />
<p align="right"><input type="submit" value="Publish" tabindex="6" id="submit" name="submit" /></p>
<?php wp_nonce_field('new-post'); ?>
</form>
,你接下來要保存到WordPress的分貝使用類似:
if('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action'])) {
// Do some minor form validation to make sure there is content
if (isset ($_POST['title'])) {
$title = $_POST['title'];
} else {
echo 'Please enter a title';
}
if (isset ($_POST['description'])) {
$description = $_POST['description'];
} else {
echo 'Please enter the content';
}
// Add the content of the form to $post as an array
$post = array(
'post_title' => $title,
'post_content' => $description,
/* 'post_category' => array('cat' => '3'), */ // Usable for custom taxonomies too
'post_status' => 'pending', // Choose: publish, pending, draft, auto-draft, future, etc.
'post_type' => 'post' // Use a custom post type if you want to
);
$newID = wp_insert_post($post); // Pass the value of $post to WordPress the insert function
// http://codex.wordpress.org/Function_Reference/wp_insert_post
// wp_redirect(home_url());
} // end IF
// Do the wp_insert_post action to insert it
do_action('wp_insert_post', 'wp_insert_post');
這是它的基本功能...祝你好運!
不知道你的項目的細節,我可以提供這作爲一個起點:
關於圖片上傳,WordPress的利用免費上傳處理Plupload的一些版本WP的當前版本(3.3 ),它將處理圖片上傳。
如果您正在尋找的功能,如裁剪,調整大小,縮略圖,等等,那麼你是正確的 - 他們有一個付費文件與圖像管理器(MCImageManager)