Site logo

Archived topic

Show Featured Image Resolution under sidebar and size with GP Hooks

5 replies · Started by Ralfs on September 11, 2017

Viewing posts 1–6 of 6

How to show Featured images Size and resolution under sidebar with GP hooks? What PHP function I have to use?

I'm not too sure what you mean - any examples?

For example here - https://puu.sh/xxM4V/2ceeb0c32e.png

I want to display info about Featured image. I want to use GP Hooks, so I can display the info before sidebar on single post

Hi,
I did manage to figure it out myself:

I added this to GP hook:

<?php 
if ( has_post_thumbnail() ) {
	$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
	echo 'Resolution: '.$large_image_url[1].'x'.$large_image_url[2];
}
?>

But I need to know, is this good solution?

Actually resolving issues is a lot of fun :D Myb I should learn wp development myself. :)

That's perfect :)

This archived topic is closed to new replies.