2012-01-02 4 views
0

各投稿へのリンクを含める方法がわかりません。私が挿入するときWordpress:サイドバーでthe_permalink()を使用する方法

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

穴のサイドバーが消えます。どうすればthe_permalink()を使用できますか?

"サイドバー-right.php":のfunctions.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); 
+1

PHPコードに構文エラーがあります。 '<?php the_permalink()?>'は動作するはずです(最初の '? '疑問符の位置)。このような間違いが起きたかどうかを確認できるように、エラーログを有効にします。ここでの質問はあまり役に立ちません。 – hakre

+0

私は正しい場所にquestionmarkと試しました。私がこの質問を書いたとき、私はそれを間違って置いた。これは問題ではありません。 – Felix

+0

関数呼び出しの後にセミコロンがありません。 – NightHawk

答えて

関連する問題