wordpress默认密码
Have you ever find yourself entering the same text in all of your posts? Often people do that such as asking people to subscribe to their feeds, retweet the post, share it on facebook etc. You can always use a simple tag to add it right after the content, or you can add that text as the default content in your WordPress post editor.
您是否发现自己在所有帖子中都输入了相同的文字? 人们经常这样做,例如要求人们订阅他们的提要,转发信息,在Facebook上分享等等。您始终可以使用简单的标签在内容之后立即添加它,也可以将该文本添加为默认内容您的WordPress帖子编辑器。
Simply open up your WordPress theme’s functions.php file and paste the following code within the PHP tags ofcourse.
只需打开WordPress主题的functions.php文件并将以下代码粘贴到CoursePHP标签中即可。
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "If you like this post, then please consider retweeting it or sharing it on Facebook.";
return $content;
}
And you are done. Try to create a New Post, and you should see the new content there.
您完成了。 尝试创建一个新帖子,您应该在那里看到新内容。
Update (January 24, 2013) – One of our users asked us how to add different content for different post type in the comments. The code below will show you how to add different default content in your WordPress post editor for each specific custom post type:
更新(2013年1月24日) –我们的一位用户问我们如何在评论中为不同的帖子类型添加不同的内容。 下面的代码将向您展示如何在WordPress帖子编辑器中为每种特定的自定义帖子类型添加不同的默认内容:
add_filter( 'default_content', 'my_editor_content', 10, 2 );
function my_editor_content( $content, $post ) {
switch( $post->post_type ) {
case 'sources':
$content = 'your content';
break;
case 'stories':
$content = 'your content';
break;
case 'pictures':
$content = 'your content';
break;
default:
$content = 'your default content';
break;
}
return $content;
}
Source: Justin Tadlock
资料来源: 贾斯汀·塔德洛克(Justin Tadlock)
翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-add-default-content-in-your-wordpress-post-editor/
wordpress默认密码