用了别人的代码在首页设置显示摘要,但有图片的文章,在结尾有个超丑的图标,请问怎么可以去除并让“阅读全文”居中?
代码如下
<?php
if(preg_match('/<!--more-->/',$this->content)||mb_strlen($this->content, 'utf-8') < 270)
{
$this->content('阅读全文...');
}
else
{
$c=mb_substr($this->content, 0, 270, 'utf-8');
if(preg_match('/<pre>/',$c))
{
echo $c,'</code></pre>','...';;
}
else
{
echo $c.'...';
}
echo '</br><p class="more"><a href="',$this->permalink(),'" title="',$this->title(),'">阅读全文...</a></p>';
}
?>
显示的效果
如何去除摘要尾的这个图标?
版主: seita
Re: 如何去除摘要尾的这个图标?
我每次改坏主题就直接复原回默认主题
https://github.com/typecho/typecho/blob ... /index.php
直接在加<center>就能实现居中了。
https://github.com/typecho/typecho/blob ... /index.php
代码: 全选
<?php
/**
* Default theme for Typecho
*
* @package Typecho Replica Theme
* @author Typecho Team
* @version 1.2
* @link http://typecho.org
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('header.php');
?>
<div class="col-mb-12 col-8" id="main" role="main">
<?php while($this->next()): ?>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h2 class="post-title" itemprop="name headline"><a itemprop="url" href="<?php $this->permalink() ?>"><?php $this->title() ?></a></h2>
<ul class="post-meta">
<li itemprop="author" itemscope itemtype="http://schema.org/Person"><?php _e('作者: '); ?><a itemprop="name" href="<?php $this->author->permalink(); ?>" rel="author"><?php $this->author(); ?></a></li>
<li><?php _e('时间: '); ?><time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date(); ?></time></li>
<li><?php _e('分类: '); ?><?php $this->category(','); ?></li>
<li itemprop="interactionCount"><a itemprop="discussionUrl" href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a></li>
</ul>
<div class="post-content" itemprop="articleBody">
<?php $this->content('- 阅读剩余部分 -'); ?>
</div>
</article>
<?php endwhile; ?>
<?php $this->pageNav('« 前一页', '后一页 »'); ?>
</div><!-- end #main-->
<?php $this->need('sidebar.php'); ?>
<?php $this->need('footer.php'); ?>
直接在
代码: 全选
<?php $this->content('- 阅读剩余部分 -'); ?>
代码: 全选
<div class="post-content" itemprop="articleBody">
<center><?php $this->content('- 阅读剩余部分 -'); ?></center>
</div>