我已经创建了一个自定义贴子插件。
在添加新的自定义帖子时,我需要在此插件中添加预定义的文本/值。
是否可以在我的插件PHP文件中处理这些预定义的文本/值,并将其激活?
/*
Plugin Name: Grand Prix Autíčka
Plugin URI: http://www/
Description: Přidávání autíček
Version: 1.0
Author: Thomas Dobo
Author URI: http://www/
License: GPLv2
*/
add_action( \'init\', \'create_movie_review\' );
function create_movie_review() {
register_post_type(\'movie_reviews\', array(
\'labels\' => array(
\'name\' => \'Grand Prix Autíčka\',
\'singular_name\' => \'Movie Review\',
\'add_new\' => \'Přidat Nový\',
\'add_new_item\' => \'Add New Movie Review\',
\'edit\' => \'Upravit\',
\'edit_item\' => \'Edit Movie Review\',
\'new_item\' => \'New Movie Review\',
\'view\' => \'View\',
\'view_item\' => \'View Movie Review\',
\'search_items\' => \'Search Movie Reviews\',
\'not_found\' => \'No Movie Reviews found\',
\'not_found_in_trash\' =>
\'No Movie Reviews found in Trash\',
\'parent\' => \'Parent Movie Review\'
),
\'public\' => true,
\'menu_position\' => 15,
\'supports\' =>
array(\'title\', \'editor\', \'comments\',
\'thumbnail\',),
\'taxonomies\' => array(\'\'),
\'menu_icon\' =>
plugins_url(\'images/image.png\', __FILE__),
\'has_archive\' => true
)
);
}
add_action( \'admin_init\', \'my_admin\' );
我添加了此代码,但不起作用
I need default content only for plugins new postfunction my_editor_content( $content ) {
$content = "";
if ( \'movie_reviews\' == get_post_type() ) {
$content = "This is some custom content I\'m adding to the post editor because I hate re-typing it.";
}
return $content;
}
请告知