3

Sorry for any wrong details. I am totally new to WordPress development. I am running a photo site. On single attachment page, I want to show the details (i.e upload date, filename, size, resolution) of the attached image in the sidebar of that single attachment page. I am trying to use the following function in the single-attachment-sidebar-template.php

<?php wp_get_attachment_metadata( $attachment_id, $unfiltered ); ?>

But it makes the whole sidebar invisible. I am trying to get something like post metabox in the editable interface for the image to be visible on the front in the sidebar area of the single attachment page.

Any help will be greatly appreciated. Thanks in Advance!

  • Could you post a little bit more of your code? That will help to check, why it's not working properly... – Krzysiek Dróżdż Jul 30 '18 at 11:23
-2
filesize( get_attached_file( $attachment->ID ) );

better you can share your site.

  • Could you elaborate why do you think this is an answer? – Krzysiek Dróżdż Jul 30 '18 at 11:22
  • hi, if you want to show the details in single.php then you can add code in that file. if other then called to separate file. – Jahangir Jul 30 '18 at 11:23
  • add this code in theme single.php file <?php the_title();?> Title : <?php the_title();?><br/> Category : </strong> <?php the_category(' &bull; ') ?> <br/> Viewed :</strong><?php echo getPostViews(get_the_ID());?><br/> Resolution : <?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full'); echo $large_image_url[1]?> x <?php echo $large_image_url[2]?>px <br/> Tags :</strong><?php the_tags( $before = '', $sep = ', ', $after = '' );?><br/> – Jahangir Jul 30 '18 at 11:36
  • hello Krzysiek Dróżdż, check here is correct ans. – Jahangir Jul 30 '18 at 11:38
  • Sorry, but I don't think it's a full answer for that question. It only shows size of that image. – Krzysiek Dróżdż Jul 30 '18 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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