<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}
?>
<h2 id="category-title" class="archive-title">
    <?php printf(__('%s', 'pmthemes'), '<span>' . single_cat_title( '', false ) . '</span>'); ?>
</h2>
<div class="related-posts-grid">
    <div class="related-posts-columns related-posts-three-columns clearfix">
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <div class="related-post-column clearfix">
                <a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
                    <?php the_post_thumbnail('featured_image'); ?><p class="viewdts"></p></a>
                <div class="shopbttn">
                    <span class="buyprice"><?php echo get_post_meta($post->ID, "pmns_price", true); ?></span>
                    <a href="http://www.amazon.com/gp/aws/cart/add.html?AssociateTag=<?php echo get_option( 'wp_amazonpin_aaid' ) ?>&ASIN.1=<?php echo get_post_meta($post->ID, "pmns_asin", true); ?>&Quantity.1=1&SubscriptionId=<?php echo get_option( 'wp_amazonpin_abk' ) ?>" target="_blank" rel="nofollow">
                        <span class="buynowrel">&nbsp;Buy Now</span></a>
                    <div class="clearfix"></div>
                    <header class="entry-header">
                        <?php the_title( sprintf( '<h4 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h4>' ); ?>
                    </header>
                </div>
            </div>
        <?php endwhile; endif; ?>
    </div>
</div>