RiProV2美化-自动添加标签

功能介绍

当写完文章之后,标签不知道设置什么好点或者说是不想设置的时候,就可以说使用该功能,启用该功能之后可自动为文章添加已使用过标签

配置教程

首先利用宝塔或则FTP打开/inc/options下的admin-options.php文件把下面代码放在20行左右

array(
'id' => 'is_automatically_add_labels',
'type' => 'switcher',
'title' => '自动添加标签',
'label' => '启用后可自动为文章添加已使用过标签',
'default' => false,
),

最后在主题根目录下打开functions.php将以下代码放在最后即可

//+----------------------------------------------------------------------
//| 自动为文章添加标签
//+----------------------------------------------------------------------
function auto_add_tags(){
$tags = get_tags( array('hide_empty' => false) );
$post_id = get_the_ID();
$post_content = get_post($post_id)->post_content;
if ($tags) {
foreach ( $tags as $tag ) {
// 如果文章内容出现了已使用过的标签,自动添加这些标签
if ( strpos($post_content, $tag->name) !== false)
wp_set_post_tags( $post_id, $tag->name, true );
}
}
}
if(_cao('is_automatically_add_labels')){
add_action('save_post', 'auto_add_tags');
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
日主题系列

RiProV2美化-禁止生成缩略图

2022-10-21 10:30:42

日主题系列

RiProV2美化-去除后台登录多语言

2022-10-22 2:39:05

17 条回复 A文章作者 M管理员
  1. تركيبات مصنع إيليت بايب Elite Pipe تُظهر دقة أبعاد رائعة ويتم تصنيعها باستخدام مواد عالية الجودة ، مما يضمن أداءً وموثوقية طويلة الأمد.

  2. Wow, amazing blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is magnificent, as well as the content!

  3. Hi, i think that i saw you visited my web site thus i came to ?eturn the favor텶 am attempting to find things to improve my web site!I suppose its ok to use some of your ideas!!

  4. Thank you for the good writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! However, how could we communicate?

  5. Simply desire to say your article is as surprising. The clearness in your post is simply excellent and i could assume you are an expert on this subject. Fine with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please carry on the gratifying work.

  6. I do not even know how I ended up here, but I thought this post was great. I don’t know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

  7. Wow, wonderful blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is great, as well as the content!

  8. I was suggested this web site by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my trouble. You are incredible! Thanks!

  9. I do agree with all the ideas you have introduced on your post. They are very convincing and will definitely work. Still, the posts are very short for newbies. May just you please prolong them a little from subsequent time? Thank you for the post.

  10. I do not even know how I ended up here, but I thought this post was great. I do not know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  11. Wow, amazing blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is magnificent, as well as the content!

  12. Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts. Anyway I will be subscribing to your augment and even I achievement you access consistently fast.

  13. Fantastic site. Lots of helpful information here. I am sending it to some friends ans additionally sharing in delicious. And of course, thanks for your effort!

  14. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but other than that, this is fantastic blog. A great read. I’ll certainly be back.

  15. Thank you, I have just been searching for information approximately this topic for a while and yours is the best I have found out so far. However, what in regards to the bottom line? Are you certain concerning the supply?

  16. hi!,I like your writing so much! share we be in contact more approximately your article on AOL? I need a specialist in this area to resolve my problem. Maybe that is you! Looking ahead to see you.

  17. Your article helped me a lot, is there any more related content? Thanks!

个人中心
今日签到
有新私信 私信列表
搜索
赣ICP备2021010644号-1