1. 实现在typecho撰写文章时隐藏部分内容,仅限回复可见
2. 设置随机播放音乐。
在文件handsome/libs/Get.php中修改:
在文件handsome/libs/Get.php中修改:
case 'collect':
$datas = $api->format(true)->playlist($id);
$datas = json_decode($datas,true);
foreach ( $datas as $keys => $data){
$cover = json_decode($api->format(true)->pic($data['pic_id']),true)['url'];
$info[$keys] = array(
'name' => $data['name'],
'url' => '',
'song_id' => $data['id'],
'cover' => $cover,
'author' => $data['artist'][0]
);
}
shuffle($info); //此处加入随机播放代码
break;
3. 解决Typecho文章cid不连续的问题。
将以下代码保存为php文件,上传至网站根目录,在浏览器地址栏访问一下即可。
特别提醒:请在PHP7以下版本的服务器上执行。本操作涉及数据库,请提前做好备份工作。文章cid重新排列后,上传的附件所属文章可能不正确,需手动修改。
<?php
/**
* Typecho重新排列不连续的文章ID
* 作者:http://www.n-1.cn/
*/
$hostname_blog = "localhost";
$database_blog = "数据库名";
$username_blog = "数据库用户名";
$password_blog = "数据库密码";
$blog = mysql_pconnect($hostname_blog, $username_blog, $password_blog) or trigger_error(mysql_error(),E_USER_ERROR);
$no = 1;
function change_id($cid)
{
global $no;
// 修改post cid,并修改分类、标签、自定义字段、评论的对应关系
$sql = 'update typecho_contents set cid = ' . $no . ' where cid = ' . $cid;
mysql_query($sql);
$sql = 'update typecho_relationships set cid = ' . $no . ' where cid = ' . $cid;
mysql_query($sql);
$sql = 'update typecho_comments set cid = ' . $no . ' where cid = ' . $cid;
mysql_query($sql);
$no = $no + 1;
}
mysql_select_db($database_blog, $blog);
$query_postRecord = "SELECT cid FROM typecho_contents ORDER BY cid ASC";
$all_postRecord = mysql_query($query_postRecord);
$row_postRecord = mysql_fetch_assoc($all_postRecord);
do {
change_id( $row_postRecord['cid'] );
} while ($row_postRecord = mysql_fetch_assoc($all_postRecord));
// 重新设置post id自增起点
mysql_query('alter table typecho_contents AUTO_INCREMENT = ' . $no);
echo 'ok';
?>
4. Handsome 文章底部添清新的加版权说明 SEO收录优化。
- 首先自定义css添加css代码
/*文章底部版权https://dxoca.cn/SiteLog/196.html*/
.cpright {
padding: 10px;
background: rgba(220, 220, 220, 0.1);
margin: 8px 0;
font-size: 13px;
border-left: 3px #f07aab96 solid;
position: relative;
z-index: 1;
font-family: "Microsoft Yahei","Droid Serif",Georgia,"Times New Roman",STHeiti,serif;
text-align: left;
}
.cpright a:hover {
color: #ff7979e8!important;
}
.cpright a {
color: #999!important;
margin: 4px;
border-bottom: 0px solid #999!important;
}
- 其次在handsome主题post.php
</div>
<?php if ($this->options->adContentPost != ""): ?>
<!--文章页脚的广告位-->
<?php $this->options->adContentPost(); ?>
<?php endif; ?>
<!--文章的页脚部件:打赏和其他信息的输出-->
<?php echo Content::exportPostFooter($this->modified,$this->options->timezone - idate("Z"),$this); ?>
<?php if (!empty($this->options->featuresetup) && in_array('payforauthorinpost', $this->options->featuresetup)): ?>
<!--打赏模块-->
<?php echo Content::exportPayForAuthors(); ?>
<?php endif; ?>
<!--/文章的页脚部件:打赏和其他信息的输出-->
</div>
的前面插入如下代码:
<div class="cpright">
<span>本文作者:<span class="sr-only"><?php _me("作者") ?>:</span> <a class="meta-value" href="<?php $this->author->permalink(); ?>" rel="author"> <?php $this->author(); ?></a></span>
文章标题:<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a><br><span>本文地址:<a href="<?php $this->permalink() ?>"><?php $this->permalink() ?></a></span> <br><span>版权说明:若无注明,本文皆为“<a href="<?php $this->options->siteUrl(); ?>" target="_blank" data-original-title="<?php $this->options->title() ?>"><?php $this->options->title() ?></a>”原创,转载请保留文章出处。</span>
</div>
5. Typecho下实现一键评论打卡功能。
- 首先在后台-->设置外观-->开发者设置-->自定义JavaScript加入以下代码:
function addNumber(a) {
var length = document.getElementById("comment").value.length;
if(length> 0){
document.getElementById("comment").focus()
document.getElementById("comment").value += '\n' + a + new Date
}else{
document.getElementById("comment").focus()
document.getElementById("comment").value += a + new Date
}
}
- 打开主题目录的/handsome/component/comments.php里面的126行到141行:
<div class="comment-form-comment form-group">
<label for="comment"><?php _me("评论") ?>
<span class="required text-danger">*</span></label>
<textarea id="comment" class="textarea form-control OwO-textarea" name="text" rows="5" placeholder="<?php _me("说点什么吧……") ?>" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('submit').click();return false};"><?php $this->remember('text'); ?></textarea>
<div class="OwO"></div>
<div class="secret_comment" id="secret_comment" data-toggle="tooltip"
data-original-title="<?php _me("开启该功能,您的评论仅作者和评论双方可见") ?>">
<label class="secret_comment_label control-label"><?php _me("私密评论") ?></label>
<div class="secret_comment_check">
<label class="i-switch i-switch-sm bg-dark m-b-ss m-r">
<input type="checkbox" id="secret_comment_checkbox">
<i></i>
</label>
</div>
</div>
</div>
替换为:
<div class="comment-form-comment form-group">
<label for="comment"><?php _me("评论") ?> <span class="required text-danger">(请使用真实邮箱地址,方便接收评论回复)</span>
<span class="required text-danger"></span></label>
<textarea id="comment" class="textarea form-control OwO-textarea" name="text" rows="5" placeholder="<?php _me("说点什么吧……") ?>" onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('submit').click();return false};"><?php $this->remember('text'); ?></textarea>
<div class="OwO" style="display: inline;"></div><div class="OwO" style="display: inline;"><a href="javascript:addNumber('滴!访客卡!请上车的乘客系好安全带,现在是:')" class="OwO-logo"><i class="fontello fontello-user face"></i><span class="OwOlogotext">打卡</span></a></div>
<div class="secret_comment" id="secret_comment" data-toggle="tooltip"
data-original-title="<?php _me("开启该功能,您的评论仅作者和评论双方可见") ?>">
<label class="secret_comment_label control-label"><?php _me("私密评论") ?></label>
<div class="secret_comment_check">
<label class="i-switch i-switch-sm bg-dark m-b-ss m-r">
<input type="checkbox" id="secret_comment_checkbox">
<i></i>
</label>
</div>
</div>
</div>
最后在后台-->设置外观-->开发者设置-->自定义CSS加入以下代码:
.secret_comment {
top: 5px;
}
.OwO.OwO-open .OwO-body {
display:table
}
6. 永久删除首页网站标题Hello world。
- 打开../handsome/index.php找到36行h1标签删除即可。
7. handsome 主题三栏改成白色 。
- 首先主题色调改成 3. white-white-black,
- 进入网站根目录 找到:usr/themes/handsome/component/aside.php 文件打开编辑 把12行左右的
<?php echo Content::selectAsideStyle(); ?>
删掉或者注释掉 然后在下面添加
<aside id="aside" class="app-aside hidden-xs bg-white-only">
有原因
::paopao:tieba_emotion_01::
滴!访客卡!请上车的乘客系好安全带,现在是:Sat Nov 09 2019 16:32:44 GMT+0800 (CST)
滴!访客卡!请上车的乘客系好安全带,现在是:Fri Nov 08 2019 12:50:40 GMT+0800 (China Standard Time)