Featured image of post Typecho插件 文章标签

Typecho插件 文章标签

typecho插件-文章标签

方法一 、官方下载

Typecho 文章标签选择器插件: https://typecho.work/archives/tagshelper.html
github 地址: https://github.com/typecho-fans/plugins/tree/master/tagshelper

插件存放路径:/mnt/mydisk/home/typecho/typecho/usr/plugins
回到后台,启用 tagshelper 插件,再打开文章撰写页面,右下角会出现可选择的标签项


方法二 、手动创建

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
mkdir -pm 777 /mnt/mydisk/home/typecho/typecho/usr/plugins/tagshelper && touch /mnt/mydisk/home/typecho/typecho/usr/plugins/tagshelper/Plugin.php && cat > touch /mnt/mydisk/home/typecho/typecho/usr/plugins/tagshelper/Plugin.php <<'EOF'
<?php
/**
 * 后台编辑文章时增加标签选择列表
 * 
 * @package tagshelper
 * @author 泽泽社长
 * @version 1.1
 * @link http://blog.zezeshe.com
 */
class tagshelper_Plugin implements Typecho_Plugin_Interface
{ 
 public static function activate()
	{
Typecho_Plugin::factory('admin/write-post.php')->bottom = array('tagshelper_Plugin', 'tagslist');
    }
	/* 禁用插件方法 */
	public static function deactivate(){}
    public static function config(Typecho_Widget_Helper_Form $form){

    }
    
    public static function personalConfig(Typecho_Widget_Helper_Form $form){}


    public static function tagslist()
    {

      
?><style>.tagshelper a{cursor: pointer; padding: 0px 6px; margin: 2px 0;display: inline-block;border-radius: 2px;text-decoration: none;}
.tagshelper a:hover{background: #ccc;color: #fff;}
</style>
<script> $(document).ready(function(){
    $('#tags').after('<div style="margin-top: 35px;" class="tagshelper"><ul style="list-style: none;border: 1px solid #D9D9D6;padding: 6px 12px; max-height: 240px;overflow: auto;background-color: #FFF;border-radius: 2px;"><?php
$i=0;
Typecho_Widget::widget('Widget_Metas_Tag_Cloud', 'sort=count&desc=1&limit=200')->to($tags);
while ($tags->next()) {
echo "<a id=".$i." onclick=\"$(\'#tags\').tokenInput(\'add\', {id: \'".$tags->name."\', tags: \'".$tags->name."\'});\">".$tags->name."</a>";
$i++;
}
?></ul></div>');
  });</script>
<?php

    }
}
EOF

回到后台,启用 tagshelper 插件,再打开文章撰写页面,右下角会出现可选择的标签项

本博客已稳定运行 小时 分钟
共发表 112 篇文章 · 总计 109.83 k 字
本站总访问量