is this possible to show next post on clicking an image in wordpress?

i try this but its not working for me… please help me thank you in advance

 <?php $next_post = get_next_post(); if (!empty( $next_post )): ?>
      <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
    <a href="<?php echo get_permalink( $next_post->ID ); ?>"> <img src="<?php echo $url; ?>" /> 
       <?php echo $next_post->post_title; ?>
    </a>

    <?php endif; ?>

is any one knows how to do this.

Related posts

Leave a Reply

1 comment

  1. Muddasir,

    Try something like this:

    For the next post

    <?php next_posts_link('<img src="imageURL.com/next.png" />'); ?>
    

    For the previous post

    <?php previous_posts_link('<img src="imageURL.com/previous.png" />'); ?>