For my website which uses a custom theme I want to use resize the featured image based on whether the user is on a blog index page or a single page.
I use below code:
<?php if (has_post_thumbnail( $post->ID ) : ?> <?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail-large' ); ?> <div class="post-media"> <a class="featured-image" href="<?php the_permalink(); ?>" title="<?php printf(__('Open %s', 'dot'), get_the_title()); ?>"><img src="<?php echo $image; ?>" class="wp-post-image" alt="Featured Image"></a> </div> <?php endif; ?>
This same code is placed in both index.php and single.php. How do resize them?
- The topic ‘Using photon with different resizing on different pages’ is closed to new replies.