0

i have a trouble with wordpress custom pages when i set page-{slug}.php, It is not working and it shows index's contents. It is used to work until i updated the wordpress version 4.9.2 to 4.9.4

I did reinstall wordpress 4.9.2 and tried it again. It is still not working

How can i solve it.

index.php

<?php get_header(); ?>
<div class="container">
<?php masterslider(2); ?>

</div>
<?php get_footer(); ?>

page-{slug}.php

<?php get_header("cpt"); ?>

<div class="container">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; ?>

<?php endif; ?>

 <div class="row">
    <?php $loop = new WP_Query( array( 'post_type' => 'cpt', 'posts_per_page' => 15 ) ); ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <li class="nolist"> <div class="posts">

    <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-xl-3">



    <!--Card content-->
<div class="card" >
<!---thumbnails--->

                     <a href="<?php the_permalink(); ?>"> <?php
                         // Must be inside a loop.

                        if ( has_post_thumbnail() ) {
                            the_post_thumbnail();
                        }
                         else {
                             echo '<img class="img-fluid" src="' . get_bloginfo( 'stylesheet_directory' ) 
                                    . '/img/ocg.jpg" class="img-responsive" />';
                         }
                      ?></a>
                      <!---- thumbnails end--->

  <div class="card-body">
      <h6 class="card-title"><a  href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?> </a></h6>
<hr>
      <div class="text-center">
          <a  href="<?php the_permalink(); ?>"> read</a>
      </div>

  </div>
    <div class="card-footer text-center">
    <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) ; ?> 
    </div>
</div>


<?php endwhile; ?></div>
    </div></li></div>
</div>
<?php get_footer(); ?>
1

I`m not sure, but this case can call same issue. And in this code answeer is present. I had same problem earlier.

| improve this answer | |
  • i did it but still not works. i returned 4.8 version but still not works. – YMG Feb 8 '18 at 14:23

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.