Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an attachment template #10

Open
bobbingwide opened this issue Apr 28, 2021 · 6 comments
Open

Create an attachment template #10

bobbingwide opened this issue Apr 28, 2021 · 6 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request feechur It doesn't appear right. Who needs to know? help wanted Extra attention is needed

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Apr 28, 2021

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

  • Ability to display screenshots which have been uploaded as attachments.
  • With a caption and/or description
  • And previous and next links
  • And maybe an archive or page to display all the screenshot attachments.

Proposed solution

  • Create an attachment.html template
  • Find a way of displaying the actual image for the post being displayed.
    • Crib the solution from genesis-image
    • OR use an oik shortcode.
@bobbingwide bobbingwide added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed feechur It doesn't appear right. Who needs to know? labels Apr 28, 2021
@bobbingwide bobbingwide self-assigned this Apr 28, 2021
@bobbingwide
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

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

@bobbingwide
Copy link
Owner Author

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.
WordPress/gutenberg#29887

@bobbingwide
Copy link
Owner Author

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
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request feechur It doesn't appear right. Who needs to know? help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant