我有以下代码,但是看起来读取更多链接不起作用,请有人介意协助,我已经激活了函数文件中的摘录:
以下查询帖子: -
<?php $the_query = new WP_Query( 'showposts=5' ); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php the_excerpt('Read more...'); ?>
<a href="<?php echo get_permalink(); ?>"> Read More...</a>
<?php endwhile;?>
答案 0 :(得分:0)
您可以使用此编辑器按钮:
分割内容:
或
然后它会在您的概述页面上显示如下:
在默认主题Twenty Twelve中,您可以使用以下代码:
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
显示Continue reading
链接。
所以在你的情况下你可以使用:
<?php the_content("Read more ...");?>
答案 1 :(得分:0)
一直为我的项目提供良好服务的简单解决方案是在functions.php
中声明一个简单的函数,如下所示:
add_filter('excerpt_more', 'new_excerpt_more');
function new_excerpt_more($more) {
global $post;
return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More ...' . '</a>';
}
然后使用以下方式拨打需要的摘录:
<?php the_excerpt(); ?>
希望这有帮助,WP codex在摘录http://codex.wordpress.org/Excerpt
上也有一些很棒的文档