如何自动在 WordPress 上的每个帖子内容中添加一些文本? [英] How to Put Some Text in every Post Content on WordPress Automatically?
本文介绍了如何自动在 WordPress 上的每个帖子内容中添加一些文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望每个帖子都必须在每个类似帖子的模板中包含此内容.例如:
I want that Every Post Must Include this in every Post Like Template. For Example:
我的帖子标题:时间管理帖子内容:[朋友们,我们的帖子标题"的文章怎么样.你喜欢它?如果有任何疑问,请不要忘记在下面发表评论.有关发布标题"的更多文章,请订阅我们.]
My Post Title: Time Management Post Content: [So Friends, How is our Article of "Post-Title". Do You Like it? Don't Forget to Comment below if Any Queries. For More Article regarding "Post-Title" Subscribe Us.]
我希望这个自动放在文章末尾的每个帖子中.请帮我.如果有人知道.
I want this to put in every post at the end of the Article Automatically. Please Help Me. If Anyone Knows it.
推荐答案
add_filter( 'the_content', 'filter_the_content_in_the_main_loop' );
function filter_the_content_in_the_main_loop( $content ) {
// Check if we're inside the main loop in a single post page.
if ( is_single() && in_the_loop() && is_main_query() ) {
return esc_html__("So Friends, How is our Article of ".get_the_title().". Do You Like it? Don't Forget to Comment below if Any Queries. For More Article regarding ".get_the_title()." Subscribe Us.").$content;
}
return $content;
}
这篇关于如何自动在 WordPress 上的每个帖子内容中添加一些文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文