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:
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:
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!
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.
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.
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?
You must be logged in to reply to this topic.