我想在链接之前改变内容的风格,但要单一。php。
更具体地说,我在主页上的所有帖子都只有一个摘要,由于使用了more标签,其余的文字都被删掉了。因此,当我点击“阅读更多”时,我看到了完整的帖子,从我们之前在主页上看到的摘要开始。我想将此摘要与文本的其余部分区分开来,例如添加一些粗体字,以向用户显示他已经阅读的内容。
不幸的是,我认为这是不可能的。是吗?
我想在链接之前改变内容的风格,但要单一。php。
更具体地说,我在主页上的所有帖子都只有一个摘要,由于使用了more标签,其余的文字都被删掉了。因此,当我点击“阅读更多”时,我看到了完整的帖子,从我们之前在主页上看到的摘要开始。我想将此摘要与文本的其余部分区分开来,例如添加一些粗体字,以向用户显示他已经阅读的内容。
不幸的是,我认为这是不可能的。是吗?
使用:http://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior
和$strip\\u摘要参数:http://codex.wordpress.org/Function_Reference/the_content#Usage
单件。php,替换<?php the_content(); ?>
使用:
<?php if( strpos(get_the_content(), \'<span id="more-\') ) : ?>
<div class="before-more">
<?php global $more; $more=0; the_content(\'\'); $more=1; ?>
</div>
<?php endif; ?>
<?php the_content(\'\', true); ?>
我通过创建两个要拆分的函数来解决这个问题the_content()
在前后函数中:
class MyClass
{
/**
* Echo the content before the <!--more--> tag
*/
public static function getContentBeforeMore()
{
global $more;
$more = false;
the_content(false);
$more = true;
}
/**
* Echo the content after the <!--more--> tag
*/
public static function getContentAfterMore($removeMoreTag = true)
{
$content = get_the_content(null, true);
$content = apply_filters( \'the_content\', $content );
$content = str_replace( \']]>\', \']]>\', $content );
// Remove the empty paragraph with the <span id="more-.."></span>-tag:
if($removeMoreTag)
{
$content = preg_replace(\'/<p><span id="more-\\d+"><\\/span><\\/p>/m\', \'\', $content);
}
echo $content;
}
}
在模板中,可以这样使用:<p class="intro"><?php MyClass::getContentBeforeMore(); ?></p>
... some other styling, like date or something ...
<?php MyClass::getContentAfterMore(); ?>
以下是我遇到的问题:http://www.ashleymosuro.com/newsite/about出于某种原因,我为Jquery UI创建的自定义主题被google托管的样式表覆盖,我不知道它在主题中的什么地方引用了样式表。不管它在哪里,我都需要把它处理掉。我试图在侧边栏中设置进度条的样式,使其达到20px高。我已经在我的自定义主题样式表中这样做了,但它一直被覆盖。有什么建议吗?谢谢