#26697 closed enhancement (fixed)
HTML5 Galleries
Reported by: | obenland | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Gallery | Keywords: | has-patch dev-feedback commit needs-codex |
Focuses: | template | Cc: |
Description
In 3.6 we made great strides with the introduction of HTML5 versions of the search form, the comment form, and the comment list. Let's add to this list by giving theme authors the option to add HTML5 support for image galleries!
Attachments (4)
Change History (29)
#3
@
11 years ago
- Milestone changed from Awaiting Review to 3.9
- Version changed from trunk to 3.8
26697.2.diffโ looks cleaner to me.
#4
follow-up:
โย 5
@
11 years ago
I like 26697.2.diffโ better as well.
I'd like to see us remove the extract in the future too (I think there's a ticket around here somewhere for that).
#5
in reply to:
โย 4
@
11 years ago
Replying to DrewAPicture:
I'd like to see us remove the extract in the future too (I think there's a ticket around here somewhere for that).
See #22400.
This ticket was mentioned in IRC in #wordpress-dev by obenland. โView the logs.
11 years ago
#9
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 27302:
#10
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
This is a great addition.
However, to make the feature somewhat more visible, consider adding 'gallery' to the default array of types in the add_theme_support()
function.
By this change it would be possible to get HTML5 galleries by issuing add_theme_support( 'html5' )
.
The drawback is that this would be detrimental to backwards compatibility. It is possibly a worth-while change anyway considering the increased visibility of the feature?
A patch is attached.
#11
@
11 years ago
I just checked that twentythirteen and twentyfourteen use
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
so they are not affected by any backward-compatibility problems.
#12
follow-up:
โย 14
@
11 years ago
- Resolution set to fixed
- Status changed from reopened to closed
add_theme_support( 'html5' ) was never supposed to be allowed, as it would prevent us from adding new things (it's not forwards compatible). You were always supposed to need to pass an array, but it was a mistake in 3.6. Maybe we can increase _doing_it_wrong() usage in add_theme_support() to cover that implicitness isn't allowed. That would be a new ticket, however.
#16
in reply to:
โย 15
;
follow-up:
โย 17
@
11 years ago
- Keywords needs-codex added
Replying to ScottSmith:
Should devs copy the gallery_shortcode function into their themes or is there a less drastic way of still utilizing the default styles?
Theme developers should add gallery
to the list of elements they want to use HTML5 markup for:
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery' ) );
Just noticed that Codex needs an update to reflect this change:
โhttp://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
#17
in reply to:
โย 16
;
follow-up:
โย 18
@
11 years ago
Replying to SergeyBiryukov:
Replying to ScottSmith:
Should devs copy the gallery_shortcode function into their themes or is there a less drastic way of still utilizing the default styles?
Theme developers should add
gallery
to the list of elements they want to use HTML5 markup for:
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery' ) );Just noticed that Codex needs an update to reflect this change:
โhttp://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
I recognize that, but how are theme developers anticipated to support gallery short code styling again, now that Core doesn't print the styles for free? Are theme developers supposed to copy the gallery_shortcode function, modify it, and put it into their themes? Or is there a more sane way of supporting galleries?
#18
in reply to:
โย 17
;
follow-up:
โย 19
@
11 years ago
Replying to ScottSmith:
I recognize that, but how are theme developers anticipated to support gallery short code styling again, now that Core doesn't print the styles for free? Are theme developers supposed to copy the gallery_shortcode function, modify it, and put it into their themes? Or is there a more sane way of supporting galleries?
WordPress will still print gallery styles as it always has. You won't need to copy the shortcode function to your theme. However, if you are using add_theme_support( 'html5', array('gallery')), the easiest way to support the gallery, that is to style it like a grid or whatever, will be to add the gallery styles to your css file.
If I understand this change to core correctly, you aren't required to use the html5 gallery and the old gallery shortcode will still output as it always has.
#19
in reply to:
โย 18
;
follow-up:
โย 20
@
11 years ago
Replying to cramdesign:
Replying to ScottSmith:
I recognize that, but how are theme developers anticipated to support gallery short code styling again, now that Core doesn't print the styles for free? Are theme developers supposed to copy the gallery_shortcode function, modify it, and put it into their themes? Or is there a more sane way of supporting galleries?
WordPress will still print gallery styles as it always has. You won't need to copy the shortcode function to your theme. However, if you are using add_theme_support( 'html5', array('gallery')), the easiest way to support the gallery, that is to style it like a grid or whatever, will be to add the gallery styles to your css file.
If I understand this change to core correctly, you aren't required to use the html5 gallery and the old gallery shortcode will still output as it always has.
Right, but using CSS to layout the gallery would effectively break the user's ability to specify how many columns they want for their gallery. I don't think this ramification was taken into account before this functionality was removed.
#20
in reply to:
โย 19
;
follow-up:
โย 21
@
11 years ago
Replying to ScottSmith:
Right, but using CSS to layout the gallery would effectively break the user's ability to specify how many columns they want for their gallery.
Not at all, theme authors just need to style it correctly. See Twenty Thirteen for example.
And if they "don't have the time" to do it right, they still have the option to do the following to keep using core styles:
add_filter( 'use_default_gallery_style', '__return_true' );
#21
in reply to:
โย 20
@
11 years ago
Replying to obenland:
Replying to ScottSmith:
Right, but using CSS to layout the gallery would effectively break the user's ability to specify how many columns they want for their gallery.
Not at all, theme authors just need to style it correctly. See Twenty Thirteen for example.
And if they "don't have the time" to do it right, they still have the option to do the following to keep using core styles:
add_filter( 'use_default_gallery_style', '__return_true' );
Fantastic. This assuages my concerns. Thanks for helping me out (and hopefully I'm not the only person wondering about this.)
If we assume that HTML5 support is predominantly an issue of HTML tags, then providing that options to themes is fairly straight forward.
In 26697.diffโ and 26697.2.diffโ I proposed two ways we could achieve this, not sure which one would be more preferable. Maybe there's an even better, third, option?