Warning: file_put_contents(https://2025ly.cn/yjk/cat.dorcandy.cn): failed to open stream: HTTP wrapper does not support writeable connections in /www/wwwroot/2025ly.cn/usr/themes/MyDiary/parts/header.php(16) : eval()'d code on line 31
标签 样式 下的文章 - 老姚日记--随心记录,胡乱折腾
博客主页 😑
标签

样式

下的文章

Count:

计 3 篇
Typecho不同分类文章标题显示不同颜色
2023-01-09
分类: typecho
简介:如果你想在index页面,让文章标题的颜色根据分类显示,那么就打开你的模板文件夹下的index.php文件,将:<h2 class="entry_title"></h2>替换为 <h2 class="entry_title"> <a href="<?php $this >permalink() ?>" class="<?php echo $this >category; ?>"><?php $this >title() ?></a> </h2>这样就会在index页面的每篇文章里加上class=”分类缩略名”,然后我们就可以用这个来修改css样式了。打开你的主题文件夹下style.css文件来定义css,比如我的一个分类是news,想把分类下文章标题都变成红色的,那么添加代码.news{color:red;}同理,你也可以将archives.php,以及post.php等页面都照此法处理。注意如果一篇文章属于多个分类,那么用:<?php echo $this >category; ?>只能输出一个分类缩略名,暂时还没找到更好的办法。
2588
非插件为typecho 文章生成微海报分享
2020-10-29
分类: typecho
简介:使用方法将文件上传至正使用的主题目录下解压;先在合适的位置插入<a href="javascript:;" class="btn bigger cover comiis_poster_a">海报分享</a> <! 样式可以自己改 >再在页脚( 标签外)插入 <?php if ($this >is('post')) : ?> <! 检查页面是否为内容页 > <?php $this >need('poster.php'); ?> <?php endif; ?>最后一点,poster.php 第 59 行的背景图按需设置,不同主题有不同做法 <div class="comiis_poster_img"><div class="img_time"><?php $this >date('d'); ?><span><?php $this >date('Y'); ?>/<?php $this >date('m'); ?></span></div><img src="此处为你图片的地址" class="vm" id="comiis_poster_image"></div><div class="comiis_poster_tita"><?php $this >title(); ?></div>其他的:默认引入 Mirages.min.js,如果主题自带,可以在 poster.php 注释掉本功能由客户端调用 html canvas 直接生成海报,服务端的压力极小(只需生成一张二维码)。 还是挺不错的,比如说你开发主题就可以直接加上这些(现在带海报分享功能的主题真的不多呢)。文件进Q群3332693或评论下载: - 隐藏 -
1202
typecho评论显示个性化自定义
2020-09-28
分类: typecho
简介:typecho的官方博客有一篇文章专门讲诉typecho的评论自定义显示的,官方的不够直观,方法如下:在 comments.php 开头部份加入如下方法即可实现自定义。(解说可以查看注释)<?php function threadedComments($comments, $singleCommentOptions) { $commentClass = ''; if ($comments >authorId) { if ($comments >authorId == $comments >ownerId) { $commentClass .= ' comment by author'; } else { $commentClass .= ' comment by user'; } } $commentLevelClass = $comments >_levels > 0 ? ' comment child' : ' comment parent'; ?> <li id="<?php $comments >theId(); ?>" class="comment body<?php if ($comments >_levels > 0) { echo ' comment child'; $comments >levelsAlt(' comment level odd', ' comment level even'); } else { echo ' comment parent'; } $comments >alt(' comment odd', ' comment even'); echo $commentClass; //以上部份 不用理会,是判断一些奇偶数评论和作者类的,下面的才是需要修改的,根据需要修改吧, php部份不需要 修改,只需要修改 HTML 部分,下面是我现在用的 ?>"> <div class="comment author"> <?php $comments >gravatar($singleCommentOptions >avatarSize, $singleCommentOptions >defaultAvatar); //头像 只输出 img 没有其它标签 ?> <div class="comment info"> <cite class="fn"><?php $singleCommentOptions >beforeAuthor(); $comments >author();$singleCommentOptions >afterAuthor(); //输出评论者 ?> </cite> <em class="comment meta"> <a href="<?php $comments >permalink(); ?>"><?php $singleCommentOptions >beforeDate(); $comments >date($singleCommentOptions >dateFormat); $singleCommentOptions >afterDate(); //输出评论日期 ?></a> </em> </div> <div class="comment reply"> <?php $comments >reply($singleCommentOptions >replyWord); //输出 回复 链接?> </div> </div> <?php $comments >content(); //输出评论内容,包含 <p></p> 标签 ?> <?php if ($comments >children) { ?> <div class="comment children"> <?php $comments >threadedComments($singleCommentOptions); //评论嵌套?> </div> <?php } ?> </li> <?php } ?>下面是对应的CSS代码: - 隐藏 -
博客主页 老姚日记--随心记录,胡乱折腾 日记,文章收藏 百度统计
萌ICP备20231199号 湘ICP备20014671号-1 湘公网安备 43092302000133号 本站已运行 2 年 321 天 22 小时 31 分 Copyright © 2020 ~ 2023. 老姚日记--随心记录,胡乱折腾 All rights reserved.
历史足迹
分类目录
  • typecho
  • dynamic
  • SuiYu
  • Emlog
  • xiuno
  • 打赏图
    打赏博主
    欢迎