Php Wordpress:如何使用侧边栏中的_permalink()

Php Wordpress:如何使用侧边栏中的_permalink(),php,wordpress,Php,Wordpress,我想不出一个方法来包含每个帖子的链接。当我插入 <a href="<?php the_permalink() ?>">Read more</a> 您缺少分号。PHP代码中有语法错误应该有效(第一个问号的位置?问号)。启用错误日志记录,以便查看是否发生了此类错误。在这里提问没有多大用处。我试着在正确的地方打问号。当我写这个问题时,我把它放错了。所以这不是问题所在。函数调用后缺少分号。 <div id="sidebar-right"> <

我想不出一个方法来包含每个帖子的链接。当我插入

<a href="<?php the_permalink() ?>">Read more</a>


您缺少分号。

PHP代码中有语法错误<代码>应该有效(第一个
问号的位置?
问号)。启用错误日志记录,以便查看是否发生了此类错误。在这里提问没有多大用处。我试着在正确的地方打问号。当我写这个问题时,我把它放错了。所以这不是问题所在。函数调用后缺少分号。
<div id="sidebar-right">

<div id="news">
<h1 class="news">Nyheter</h1>
<div class="border"></div>

<?php
$args = array( 'numberposts' => 3 );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); 
?> 

<h2 class="news"><?php the_title(); ?></h2>
<?php the_excerpt(); ?>

//here I want the link

<?php endforeach; ?>


<div class="border"></div>

</div>

</div>
function new_excerpt_more($more) {
    return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');


function custom_excerpt_length( $length ) {
    return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
<?php the_permalink(); ?>