DEDECMS5.1 Tag首页文章分类显示

dedecms 在5.x版本新增加的 tag 标签.

在首页使用时只有row,sort与InnerText三个参数.而不能像arclist等标签一样可以用typeid参数按文章分类显示.

自己动手.修改了一下

打开 include/inc_arcpart_view.php 文件

首先找到第 222 行


}else if($tagname=="tag"){
    //自定义宏标签
    if(empty($typeid)) $typeid = $envTypeid;
    $this->dtp->Assign($tagid,
    $this->GetTags($ctag->GetAtt("row"),$ctag->GetAtt("sort"),$ctag->GetInnerText())
);

修改为:


}else if($tagname=="tag"){
    //自定义宏标签
    $typeid = trim($ctag->GetAtt("typeid"));
    if(empty($typeid)) $typeid = $envTypeid;
    $this->dtp->Assign($tagid,
    $this->GetTags($ctag->GetAtt("row"),$ctag->GetAtt("sort"),$ctag->GetInnerText(),$typeid)
);

全文阅读 »

Tags : , ,

WordPress制作标签云Tags单独页面

Wordpress自带着wp_tag_cloud()函数,但只在页面侧边显示往往就不够了.需要一个单页来放所有的Tags

p.s.在搜索引擎优化SEO上,百度似乎对关键词TAGS更为偏爱

其实就是撰写一个新页面,它要应用一个名为tags.php的自定义模板.

tags.php的内容如下

  1. <?php
  2. /*
  3. Template Name: Tags
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7. <?php get_sidebar(); ?>
  8.     <div class="narrowcolumn">
  9.         <div class="post" id="post-<?php the_ID(); ?>">
  10.             <h2>Tags</h2>
  11.             <div class="entry">
  12.                 <?php wp_tag_cloud('smallest=12&largest=12&unit=px&number=5000');?>//smallest是最小字号,largest是最大字号,unit是单位,number是显示关键词个数,默认是45个
  13.             </div>   
  14.  
  15.         </div>
  16.     </div><!-- end narrwocolumn -->
  17. <?php get_footer(); ?>

/*
Template Name: Tags
*/

这句一定不能少,要不撰写页面时就没有可以应用的模板文件。

把tags.php上传至模板目录

然后点击后台->撰写->撰写页面 页面标题为 tags。页面内容为空就可以了。 最重要的一步,选择页面模块,这里除了默认多出了一个新选项,就是刚刚才建好的tags.php模板,选择tags。因为我启用自定义的永久链接,所以页面缩略名也必不可少,还是老样子,起名为tags (起啥名都行)

发布 OK

然后给侧边栏sidebar加个链接 一切搞电。

DEMO地址:http://www.zdyi.com/index.php/tags

转载请注明

浏览最多的10篇日志

评论最多的10篇日志

随机显示的10篇日志