我已经创建了一个自定义贴子插件。
在这个插件中创建新的自定义帖子时,我需要添加预定义的文本/值。
是否可以在我的插件中处理这些预定义的文本/值。php文件,并使其处于活动状态?
<?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\' );
我添加了此代码,但它显示在我需要的所有新帖子/页面中
default content only for plugins new postadd_filter( \'default_content\', \'my_editor_content\' );
function my_editor_content( $content ) {
$content = "This is some custom content I\'m adding to the post editor because I hate re-typing it.";
return $content;
}
请告知,谢谢