2013-01-15 36 views
0

我显示来自特定类别的帖子,但我无法将其标题链接到他们所属的帖子。需要帮忙。如何链接到WordPress的标题文章?

<?php 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
$args= array(
     'category_name' => 'nyheder', // Change these category SLUGS to suit your use. 
     'paged' => $paged, 
     'numberposts' => 1 
); 
query_posts($args); ?> 

<?php 
while (have_posts()) : the_post(); 
?> 
<p class="colorWhitesmoke"><?php the_date(); ?></p> 
<a href="<!--THIS IS WHERE I HAVE NO IDEA WHAT TO WRITE... i was trying the following, but didn't quite do the trick. --><?php get_permalink($paged); ?>"> 

<h3 class="colorWhitesmoke"><?php the_title(); ?></h3> 
</a> 
<div class="colorWhitesmoke"><?php the_excerpt(); ?></div> 

<?php endwhile; 
the_bootstrap_content_nav(); 
?> 

回答

1

在wordpress的 '循环',你可以简单地使用echo get_permalink(),所以没有参数。或者,the_permalink()等效于自动回应。然后

您的代码将变为:

<a href="<?php the_permalink(); ?>"> ... </a> 
相关问题