• mak7

    (@mak7)


    Hi. 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
        }
    }
    ?>
    
    • This topic was modified 5 years ago by mak7.
    • This topic was modified 5 years ago by mak7.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I think you may have placed your code on the wrong template, such that is used for single post requests. Your code overrides whatever the original request was. Why do you create a new WP_Query? WP should give you the same list of posts without any custom code by going to either your front page or the blog index page, depending on your settings.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Howdy!

    How are you using this code?

    Personally, my first question is: what are you trying to achieve? I think this will help narrow down what could be the issue and we may able to provide a better answer as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Permalink doesn’t navigate to post (changes only url)’ is closed to new replies.