0
为了更好地解释我的问题,我将开始粘贴在自定义模板中用于拉首页的代码摘自最新博客文章以及启用摘录的特定页面。除了实际添加链接到最新博客文章或特定页面的“阅读更多”链接之外,这一切都很好。WordPress的:添加'阅读更多'链接拉到博客文章/页面的内容到首页
<?php
$id=163;
$post = get_post($id);
$title = apply_filters('the_title', $post->post_title); ?>
<h3><?php echo $title; ?></h3>
<?php $content = apply_filters('get_the_excerpt', $post->post_excerpt);
echo $content;
?>
这是用于页面摘录。我坚持要在循环中实现“Read More”。以下是拉取最新博文的代码。
<?php
$latest_post = new WP_Query("showposts=1");
if($latest_post->have_posts()) :
?>
<?php
while($latest_post->have_posts()):
$latest_post->the_post();
?>
<h4><?php the_title() ?></h4>
<?php the_excerpt(); ?>
<?php endwhile ?>
<?php endif ?>
我想要做的是在这两个函数中添加“阅读更多”链接到他们各自的帖子/页面。我有点卡住如何让这个工作,我已经尝试了几个不同的功能,他们都没有工作。
我期待着回复您对这个特殊问题的看法。
詹姆斯
谢谢你给我的修正,我简直不敢相信,我忽略了那种我之前使用过的代码。脑冻结!但再次感谢:) –