1

Below is my code in which everything is working fine except when clicking read more button it's doing nothing

<?php get_header() ; ?>

<section class="container">
        <div class="row">
            <div class="col-sm-8">
                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                    <article class="blog">
                      <div class="blog-meta">
                          <h2 class="blog-meta-title"><a href="<?php the_permalink() ; ?>"><?php the_title() ; ?></a></h2>
                            <p class="blog-meta-detail">
                              Posted by <?php the_author_posts_link(); ?> 
                              on <?php the_time('F j, Y'); ?>
                              Category <?php the_category(', ') ; ?>
                              Tag  <?php if ( is_tag() ) {
                                         the_tags('',', ','');
                                           } else {
                                      echo("No Tags Found");
                                      } ?> 
                            </p>
                      </div> <!-- .blog-meta -->
                <?php if ( has_post_thumbnail() ) : ?>
                      <div class="blog-img">
                         <?php the_post_thumbnail('full',array(
                                'class' => 'img-responsive',
                            )); ?>
                        </div> <!-- .blog-img -->
                <?php endif ; ?> <!-- if ends here of thumbnail -->
                      <div class="blog-excerpt">
                          <?php the_excerpt() ; ?>
                      </div> <!-- .blog-excerpt -->
                      <div class="blog-more">
                           <button class="btn btn-primary" href="<?php the_permalink() ; ?>">Read More</button>
                      </div> <!-- .blog-more -->
                      <div class="blog-hr">
                          <hr>
                      </div> <!-- .blog-hr -->
                    </article> <!-- .blog -->
                <?php endwhile; else : ?> <!-- while ends here of post loop and else starts -->
                     <article class="blog">
                          <p><?php _e( 'Sorry, no posts found yo can always start writing' ); ?></p>
                     </article> <!-- .blog -->
                <?php endif; ?> <!-- if ends here post loop -->      
            </div> <!-- .col-sm-8 -->
            <div class="col-sm-4">
                <?php get_sidebar() ; ?>
            </div> <!-- .col-sm-4 -->
        </div> <!-- .row -->
</section> <!-- .container -->

<?php get_footer() ; ?>

looks like dev in dev tool also link is showing correctly on read more button enter image description here thanks in advance for help.

2 Answers 2

0

I have checked your code and site.

Just replace "button" with "a href" in your code for "Read More" and it will work. Try below code -

<a class="btn btn-primary" href="https://project11-cannelflow1.c9users.io/2017/01/17/hello-world/">Read More</a>
4
  • let me try that Jan 18, 2017 at 12:59
  • Sorry for that, I have revised my answer. Please check. Jan 18, 2017 at 12:59
  • Glad it helped. Can you please vote and mark my answer as useful :) Jan 18, 2017 at 13:03
  • already did that accepted the answer upvoted also but it said my upvoted is only visible after I cross 15 reputation Jan 18, 2017 at 13:06
0

You can use another trick if you like to keep the button style.

<button class="btn btn-primary" onclick='location.href="<?php the_permalink() ; ?>"'>Read More</button>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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