【发布时间】:2015-10-28 01:13:29
【问题描述】:
在官方的 Wordpress 主题 25 中,我们在 content.php 文件中有以下代码:
<div class="entry-content">
<?php
/* translators: %s: Name of current post */
the_content( sprintf(
__( 'Continue reading %s', 'twentyfifteen' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
) );
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
) );
?>
</div><!-- .entry-content -->
我正在尝试将自定义样式应用于“继续阅读”链接(并且只有链接),但问题是“继续阅读”已经是具有“条目内容”样式的 div 的一部分。
我希望在其他地方有“继续阅读”,但我对如何做到这一点感到很困惑。
我对 PHP 不太熟悉,老实说,这可能是这里的主要问题。我花了大约一个小时试图研究如何做到这一点,但我可能没有经验来理解我正在阅读的内容。
已解决:编辑/更新:
以下代码对我有用。这将插入阅读更多链接:
<div class="more-link">
<a href="<?php the_permalink(); ?>">Read more</a>
</div>
我也变了:
the_content( sprintf(
__( 'Continue reading %s', 'twentyfifteen' ),
the_title( '<span class="screen-reader-text">', '</span>', false )
到这里:
the_content('');
【问题讨论】:
-
你能给我页面链接吗?
-
主题仅在本地服务器上,如果需要我可以上传主题。但我会先尝试 user2191227 的建议