0

I don’t know why, but I can’t navigate to post by click. I have tried get_permalink() and the_permalink() but changes only url. And i need to see only post that was pushed (alone) after click. Does anybody know what I’m doing wrong ?

<?php

$args = array(
    'post_type'=> 'post'
);
$the_query = new WP_Query( $args );

// The Loop
if ( $the_query->have_posts() ) {
    while ( $the_query->have_posts() ) {
        $the_query->the_post(); ?>
        <h2><a href="<?php the_permalink();  ?>"><?php the_title(); ?></a></h2>
      <p><?php the_content(); ?></p>
       <?php
    }
}
?>
1
  • 2
    Hi. In which file did you put this code? And how does your single.php look like? – Krzysiek Dróżdż Nov 15 '19 at 18:03
0

Sometimes you need to just go to /wp-admin/options-permalink.php and resave your settings. It happens a lot with different hosts and it just needs to be resaved in my experience.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.