0

I'm showing posts from a specific category, but I cannot make their titles link to the post they belong to. Need help.

<?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();
?>
Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
Kriszta
  • 670
  • 1
  • 7
  • 22

2 Answers2

1

Within 'the loop' of wordpress, you can simply use echo get_permalink(), so without arguments. Alternatively, the_permalink() is an equivalent that echoes this automatically.

Your code would then become:

<a href="<?php the_permalink(); ?>"> ... </a>
rmhartog
  • 2,293
  • 12
  • 19
0

the_permalink is what you need...

Reigel Gallarde
  • 64,198
  • 21
  • 121
  • 139