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

Improve Display #377

Merged
merged 21 commits into from
Jun 12, 2023
Merged

Improve Display #377

merged 21 commits into from
Jun 12, 2023

Conversation

dshanske
Copy link
Collaborator

This addresses a variety of display issues, specifically.

  • Make likes, repost and mention overlay emojis optional #372 Adding an option to disable the overlay
  • Fixes a microformats issue as the class is supposed to be the display class, but it is using the parsing class
  • Introduces a function to get the canonical URL of a webmention comment
  • Introduces a version of the comment rendering from Semantic Linkbacks. The difference between this and the stock default is that is is microformats 2 compliant and adds the citation that was present in that plugin, as well as introducing a hook to add arbitrary metadata
  • Introduce hooks proposed in templating PR by @chrisbergr

This sets up us moving into adding in #364.

@dshanske dshanske requested a review from pfefferle April 12, 2023 04:45
@pfefferle
Copy link
Owner

pfefferle commented Apr 12, 2023

Shouldn't we work on templating instead of adding so much features/settings for the "old world"? I think it would make all the changes in this PR obsolet.

/cc @chrisbergr

@pfefferle
Copy link
Owner

Why I am not a big fan of overwriting the html5_comment function:

In the current PR we only replace the template for Webmentions (which seems not 100% compatible to that in core), which means Webmentions and Comments look slightly different:

Bildschirmfoto 2023-04-12 um 10 07 40

If WordPress changes the default behaviour and/or the CSS changes, it might break Webmention representation.

Most of the themes do not rely on the comment walker template at all and implement their own representation using the comment callback. See the autonomie theme for example: wp_list_comments( array( 'callback' => 'autonomie_comment', 'format' => '' ) );.

@dshanske
Copy link
Collaborator Author

It was designed to accommodate themes that don't use the comment callback. If you use it, that would take precedence. The same issue would be the case with @chrisbergr 's pr. Which can be implemented by moving this code to template files.

@dshanske
Copy link
Collaborator Author

The goal is to create a good default presentation things could override.

@pfefferle
Copy link
Owner

But then we should at least stick with the default, so that there are no CSS differences (see my screenshot).

@dshanske
Copy link
Collaborator Author

But then we should at least stick with the default, so that there are no CSS differences (see my screenshot).

But the html5_comment version I included has no differences on the CSS by design. It adds microformats classes and the citation line that we had in Semantic Linkbacks.

@pfefferle
Copy link
Owner

But why the differences then? I will try to debug the code... maybe the theme add some CSS using microformats classes :(

@dshanske
Copy link
Collaborator Author

Everything in this implementation, as well as the new comment implementation for 5.0 was designed to be overridden the way it always was. The new way of showing the reactions loads them, then loads the theme's comment display afterward. The comment walker overrides start_el in order to allow loading additional callbacks and additional options to wp_list_comments so it is backward compatible. It allows the theme to still use its own callback...

@dshanske
Copy link
Collaborator Author

The part I don't understand is that #364 overrides html5_comment as well, but you approved that, and I want to move in that direction with a second PR.

@pfefferle
Copy link
Owner

@dshanske

Oops, I was in the wrong PR, ignore my "Approve", I want to wait, what @dshanske thinks about it!

I do not know how to un-approve 😞 it was by mistake!

pfefferle and others added 6 commits April 13, 2023 00:08
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
@dshanske
Copy link
Collaborator Author

@pfefferle @chrisbergr Added a FAQ to explain how the existing system works. While the html5_comment addition happens in this plugin, everything else I noted was already in version 5.

I think it needs it. If we expand to add a locate_template option, it would simply be another alternative.

@chrisbergr
Copy link
Contributor

If WordPress changes the default behaviour and/or the CSS changes, it might break Webmention representation.

The default template I provided uses the original code from WordPress. That's why CSS changes should not be a problem. If they change something on their html structure, it is the same problem as with any other thing that works with templates. It is not a problem that we then offer an update of the standard template. If you have ever worked with WooCommerce and have overwritten there email templates: They solve this quite nicely by noticing you that there have been changes and your template is no longer up to date.

Most of the themes do not rely on the comment walker template at all and implement their own representation using the comment callback. See the autonomie theme for example: wp_list_comments( array( 'callback' => 'autonomie_comment', 'format' => '' ) );.

This is not an issue for this topic, it is more general. If the theme uses a custom walker, the walker provided by this plugin won't be used at all.

@dshanske dshanske requested a review from pfefferle April 14, 2023 03:41
includes/class-admin.php Outdated Show resolved Hide resolved
@dshanske dshanske requested a review from pfefferle June 3, 2023 13:15
@dshanske
Copy link
Collaborator Author

dshanske commented Jun 3, 2023

@pfefferle Wanted to see about remerging this.

@pfefferle
Copy link
Owner

pfefferle commented Jun 11, 2023

The problem I still have with this PR is, that it will always overwrite the comment representation of the theme, and I have no chance to prevent that. I would love to at least have a theme_support check or something similar.

@dshanske
Copy link
Collaborator Author

No, it's the opposite, the theme will always overwrite it.

@pfefferle
Copy link
Owner

But in what case will the comment-walker version be used then?

@dshanske
Copy link
Collaborator Author

When the theme doesn't set a custom rendering, or when the theme opts to use the built in.

@pfefferle
Copy link
Owner

It is not directly because of this PR, but I see an error (on block themes) in the comments section:

Deprecated: File Theme without comments.php is deprecated since version 3.0.0 with no alternative available. Please include a comments.php template in your theme. in /var/www/html/wp-includes/functions.php on line 5583

Copy link
Owner

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pfefferle pfefferle merged commit 1e4bb44 into main Jun 12, 2023
17 checks passed
@pfefferle pfefferle deleted the displayoptions branch June 12, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants