最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Permalink doesn’t navigate to post (changes only url)

programmeradmin0浏览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
    }
}
?>

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
    }
}
?>
Share Improve this question asked Nov 15, 2019 at 17:43 Maksym DomaretskyiMaksym Domaretskyi 1 1
  • 2 Hi. In which file did you put this code? And how does your single.php look like? – Krzysiek Dróżdż Commented Nov 15, 2019 at 18:03
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论