如何从wordpress中的标题链接到帖子?

时间:2013-01-15 10:05:30

标签: wordpress customizing

我正在显示特定类别的帖子,但我无法将其标题链接到他们所属的帖子。需要帮助。

<?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();
?>

2 个答案:

答案 0 :(得分:1)

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

您的代码将成为:

<a href="<?php the_permalink(); ?>"> ... </a>

答案 1 :(得分:0)

你需要

the_permalink ......

相关问题