我已經嘗試了很多事情,但我沒有得到更多link
在paragraph
如何添加更多在WordPress
page.php文件
<?php
$args = array('post_type' => 'post', 'posts_per_page' => 10);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post();
echo '<div class="inner-box-post">';
echo '<h2><a href="get_permalink();">';
the_title();
echo '</a></h2>';
echo '<div class="thumbnail">';
the_post_thumbnail('thumbnail');
get_comments($args);
echo '</div>';
echo '<div class="post-containt">';
echo '<div class="post-date"><strong>';
echo get_the_date();
echo '</strong> </div>';
echo the_excerpt(); ;
echo '</div> ';
echo '</div>';
endwhile; ?>
</div>
function.php
function new_excerpt_more($output) {
return $output . '<p><a href="'. get_permalink() . '">' . 'Read more »' . '</a></p>';
}
add_filter('get_the_excerpt', 'new_excerpt_more');
您的代碼中不需要大量的'echo'。只需正確使用打開和關閉php標籤。 –