image.php and video.php problems | WordPress.org

I could have sworn I had this fixed. I created video and image.php which displays the videoimage title, posted date, author link, link to view the image or video, and a large thumbnail of the image. Below that, I pulled in the description and caption and a couple of other fields.

The View Image or Watch Video link should take you to the URL where ‘uploads’ is in the address and the image is on a black field. But instead, that link returns you to the same page. For example, the image of a compass brings me to http://localhost/desndev/wordpress/compass/ when I click view attachment page and the template being loaded is image.php. But when I click View Image I want the address to change to http://localhost/desndev/wordpress/wp-content/uploads/2020/11/compass.jpg.

That’s the first problem I’m having in local dev.

On my live site when I click view attachment page I go directly to the address with uploads in the address, my image.php is not loading even though my live site and local dev have the same files.

I thought I was done but something is out of sync. Why would my image.php and video.php pages load in local dev showing all the fields * have on the page, but on the live site there is no imgae.php page being shown? What am I missing? And why can’t I get the link to go to the actual image of video uploads link page? My attachment.php file is fine for audio, text and pdf files – I see the attachment page with all the details then the link takes you to the upload link.

Oh, I forgot – something else was working and now doesn’t work – the previous and next image links. Only previous or net link show, not both of them??? Here is the code I have:

image.php for the attachment link:
<span class="full-size-link"><?php esc_html_e('| ', 'tower') ?><a href="<?php esc_url(wp_get_attachment_url()); ?>"><?php echo esc_html( $metadata['width'] ); ?><?php echo esc_html( $metadata['height'] ); ?>View Image</a></span>

Here is what I am using for the open download link for all other attachments (and I did try $post->guide in image.php):

<a href="<?php echo esc_url($post->guid); ?>">Open / Download</a>

image navigation:

<nav id="image-navigation" class="navigation image-navigation">
    <div class="nav-links">
    <?php previous_image_link( false, '<span class="previous-image">' . __( 'Previous image', 'tower' ) . '</span>' ); ?>
    <?php next_image_link( false, '<span class="next-image">' . __( 'Next image', 'tower' ) . '</span>' ); ?>
    </div>
</nav>
  • This topic was modified 3 days, 20 hours ago by kernix.



Source link