bobbingwide / thisis

ThisIs ... experimental Full Site Editing theme
GNU General Public License v3.0
1 stars 0 forks source link

Create an attachment template #10

Open bobbingwide opened 3 years ago

bobbingwide commented 3 years ago

So far I've captured 51 screenshots showing the development of thisis from absolutely nothing at all to something nearly usable. I want to be able to display these screenshots as full screen, with previous and next links and the caption overlaid and the description below.

Since the screenshots are already "complete" then they don't need the header / footer I need to create an attachment.html template.

Requirements

Proposed solution

bobbingwide commented 3 years ago

I found another way to cause the site editor to produce "This block has encountered an error and cannot be previewed". I'd coded the post excerpt block incorrectly.

<!-- wp-post-excerpt /-->

should have been

<!-- wp:post-excerpt /-->

image

bobbingwide commented 3 years ago

I used a number of oik shortcodes to implement the first version. Since shortcodes can't be used directly in templates but can currently be used in template parts I wrote attachment-image.html

<!-- wp:post-title {"level": 1 } /-->
<!-- wp:html -->
<div class="featured">
[bw_field featured]
</div>
<!-- /wp:html -->

<!-- wp:html -->
[bw_fields file_size ]
[bw_fields dimensions ]
<!-- /wp:html -->

I also added some CSS to style.css to style the post title to go over the top of the screenshot. This can then be viewed in full screen. image

then scroll down to see the image dimensions, title, Caption ( post-excerpt ) and Description ( post-content ) followed by the standard footer. image

bobbingwide commented 3 years ago

Note: Previous and Next links do not work for attachments!

bobbingwide commented 3 years ago

Note: There's an open issue against post-content when used for attachments. I've added my comment indicating that I believe there should be a separate block to display the attached file. https://github.com/WordPress/gutenberg/issues/29887

bobbingwide commented 3 years ago

In order to test the behaviour when attachment.html is missing I renamed the file to single.html. Then I got confused as to which template was being loaded. Have decided to export all templates and template parts ( see #9) , then remove the database versions from the alternative site ( s.b/wp55 ) and retest.

bobbingwide commented 3 years ago

In some of the screenshots there's a Bookmarks bar, in others it's not there. There are also screenshots taken where the WordPress admin toolbar is not shown. If we reduce the padding on the title these screenshots will be easier to view.