Forums

attachment.php not same as single.php? (5 posts)

  1. gudlyf
    Member
    Posted 2 years ago #

    I would like to make use of the attachment.php or image.php template file options in WordPress, but I'm not sure where I'm going wrong. In short, I simply copied my single.php file to attachment.php, then reloaded the page with the attachment (image), and the image doesn't appear. The excerpt (image details) appear below where the image should, and the rest of the page looks fine, but the image itself doesn't appear.

    Is there something special that goes on when one uses single.php for attachment display that I'm missing in this file? Seems to me that simply copying single.php should do the same thing.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    The image/attachment template file is not the same as single.php. Have a look at the image.php file in the default theme for an example.

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Using_Image_and_File_Attachments

    Have you read over this part of the codex? It seems that certain things need to occur to determine whether single, image, or attachment.php is used.....

  4. Mark / t31os
    Moderator
    Posted 2 years ago #

    Nothing in particular needs to occur, they only need exist, which is one is used is determined by the template hierarchy.

    http://codex.wordpress.org/images/1/18/Template_Hierarchy.png
    http://codex.wordpress.org/Template_Hierarchy#Attachment_display

  5. gudlyf
    Member
    Posted 2 years ago #

    Looking at the default theme helped. Thanks for that!

Topic Closed

This topic has been closed to new replies.

About this Topic