Home / Forums / DynamiX Support / Custom Attachment Page

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts

  • Anthony OLIVEIRA
    Participant

    Hi all,

    I’ve made a page on my website with a Masonry Grid, containing images, and a button “see more” for more infos with text. The link:

    http://topeaks.fr/media/

    When we click on “see more” we go to the attachment page (because it’s a button with Post Link), seeing the photo title, the photo and a description text about this photo. Example link:

    http://topeaks.fr/media/mega-billboard/

    My problem is:

    I searched about this “attachment page” which is displaying by default with the theme. On the web, it says that if there is no file “attachment.php”, it takes the template on the file “single.php”. I want to make a custom attachment page, with the photo on the left, and the description text on the right, not under the photo. So I tried to create an “attachment.php” file, copying the “single.php” code and adding some features, but it doesn’t work. By the way, the “single.php” file which is in the DynaxmiX theme doesn’t look like most of the “single.php” files I saw on the forums…

    So I would like to know how can I create this “attachment.php” file and what I need to take to make it work? Finally my request is quite simple, I just want to “move” the fields on this page, making them right/left instead of above/under (I think it’s just HTML no?). I already managed to center the image on the page, adding some CSS tricks, but I can’t do more…

    Thanks a lot for your answers!

    Andy
    Andy
    Keymaster

    Hi,

    It’s definitely the correct method and the single.php is the most up to date method of creating the post formats. The forums is missing the fact that there are different post formats and not just a single.php file for all posts.

    You need to combine single.php with content-image.php – copy the contents of single.php into attachment.php and then copy the contents of content-image.php and paste it into attachment.php where this line is get_template_part( 'content', get_post_format() ); ( also removing this line of code ).

    From there, you’ll be able to re-arrange things.


    Anthony OLIVEIRA
    Participant
    This reply has been marked as private.
    Andy
    Andy
    Keymaster

    Hi Mickaƫl,

    What’s the email address you paid with, I’ll see if I can send an invoice from PayPal.


    Anthony OLIVEIRA
    Participant
    This reply has been marked as private.

    Anthony OLIVEIRA
    Participant

    Hi Andy,

    I did what you tell me about the single.php and content-image.php, but it displays me an error 500…I paste all the contents of “content-image.php” where the line get_template_part( 'content', get_post_format() ); is, and I removed it too.

    Here is my “attachment.php” file: http://www.cjoint.com/c/FAAo5LtHtxq

    Thanks for your help.

    Andy
    Andy
    Keymaster

    The alternative would be to revert back to the get_template_part function ( instead of pasting the code from content-image.php ), but use this instead:

    get_template_part( 'content', 'attachment' );

    Now, using the contents of the content-image.php create a content-attachment.php and paste it in there.

    I hope that helps?

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.