archetyped / simple-lightbox

The highly customizable lightbox for WordPress
http://archetyped.com/tools/simple-lightbox/
GNU General Public License v2.0
72 stars 33 forks source link

キャプションの表示 #980

Closed NEET-MAN25 closed 1 year ago

NEET-MAN25 commented 1 year ago

Description of Problem

画像のテキストにおいて、2.6.0までは「キャプション」が表示されていましたが、これ以降は「タイトル」が表示されてしまいます。

「設定」において、表示するテキストをの優先順位を「キャプション」と「タイトル」で切り替えられると非常に助かります。

個人的にはキャプションの優先順位を最上位に切り替えたいのです。

キャプションは記事中において個別に設定するものですからやはりその記事においては強調されるものだからです。タイトルはキャプションがない場合に表示されれば十分です。

(私は記事の中の画像ごとにキャプションを設定している為、タイトル表示されてしまうと記事の内容まで変わってしまうのです。こうなるとプラグイン自体使えなくなってしまいます。)

Details

インストールされているその他のプラグイン

AddQuicktag Advanced Editor Tools (旧名 TinyMCE Advanced) ※v4.5.6 Akismet Anti-Spam AmazonJS Auto Featured Image(Auto Post Thumbnail) Autoptimize BackWPup Better Delete Revision Broken Link Checker Classic Editor Classic WidgetS Contact Form 7 EWWW Image Optimizer Google XML Sitemaps Jetpack by WordPress.com Login LockDown Meta Slider Movable Type・TypePad インポートツール PS Auto Sitemap Search Regex Shortcodes Ultimate Simple Lightbox ※v2.6.0 oa v2.9.3  Speech bubble WebSub (FKA. PubSubHubbub) WP Multibyte Patch WP-Appbox WPアソシエイトポストR2 Widget Logic

(バージョンはすべて最新)

archetyped commented 1 year ago

Hi, the priority of content used as the lightbox's title has not changed between v2.6.0 and the current version (v2.9.3). The order of potential values that may be used as the lightbox's title is still as outlined in SLB's documentation on title precendence.

As per the documentation, only a manually-set title attribute supercedes a custom caption in priority. As that usually requires the link HTML to be manually edited, the title attribute is rarely used.

If you are seeing different behavior, please update your original post to include the missing details needed to fully evaluate your issue, and I would be glad to take a look.

NEET-MAN25 commented 1 year ago

丁寧なご返信ありがとうございます!

タイトルの優先順位に関する SLB のドキュメントは理解しておりますが、

v2.6.0とv2.9.3では表示される内容が異なるのです。

v2.6.0では、「記事中の画像編集におけるキャプション」が最優先で表示されています。 bandicam 2022-12-15 14-49-27-319

v2.9.3では「メディアライブラリのタイトル」が最優先で表示されます。(v2.6.0では、上記の条件のキャプションが存在しない場合に表示されていました) bandicam 2022-12-15 14-47-45-679

その他の条件はすべて同じです。(プラグイン、テーマ、WordPressのバージョン、PHPのバージョン、サーバー)

(現在ではv2.6.0を使用しております。画像のキャプションが表示されないと記事の内容が変わってしまうので、収益性が落ちてしまうからです。)

NEET-MAN25 commented 1 year ago

※加えて、これはテーマ側の問題だと思いますが(AFFINGER6)、

「v2.6.0では、記事の中の画像の数が多いと、機能しない」というエラーが発生します。

ただし前のテーマでは起きないエラーです(STINGER PRO)。v2.9.3にすればOKです。しかしそうすると今度はキャプションが表示されないので困っています。

NEET-MAN25 commented 1 year ago

メディアライブラリのタイトルは手動で設定しなくとも、

「メディアライブラリに画像をアップロードした時点で、画像の名称がそのまま使用される」ので、

v2.6.0のときもv2.9.3のときも同じ設定でした。

bandicam 2022-12-15 14-23-01-512

※「手動で設定されtitleた属性」とは、記事の中の画像編集における上級者設定で行うものではないですよね?

NEET-MAN25 commented 1 year ago

※ちなみに使用しているのは「ClassicEditor」です。ブロックエディタは使用していません。

NEET-MAN25 commented 1 year ago

v2.9.3にて、メディアライブラリのタイトルを消してみましたら、何も表示されませんでした。

これは「キャプション自体が表示されていない」ということになります。

bandicam 2022-12-15 16-57-26-534 bandicam 2022-12-15 16-56-36-343 bandicam 2022-12-15 17-03-56-576

NEET-MAN25 commented 1 year ago

テーマを変更してみたら機能しました!?

bandicam 2022-12-15 17-07-28-583

テーマの方に問題があるみたいです。

これはキャプション情報の取得を邪魔しているのが問題ですかね?

(テーマ自体がv2.6.0には対応しているがv2.8.0以降に対応していなかったということですね)

ご対応させてしまい申し訳ありません!

NEET-MAN25 commented 1 year ago

※テーマを複数変更して試しましたが、キャプション表示されるものとされないものが複数あります

NEET-MAN25 commented 1 year ago

また別のブログですが、

そこではタイトルも表示されません。今度は「記事内で画像編集した代替テキスト」が表示されます。

bandicam 2022-12-15 18-00-34-914 bandicam 2022-12-15 18-20-48-839

https://this-is-rpg.com/

bandicam 2022-12-15 17-58-16-183

https://this-is-rpg.com/simulation-rpg/9540/

こちらのブログはv2.9.3を使用しておりますので、よろしければご検証などにお使いください。

archetyped commented 1 year ago

Thank you for the additional details.

Manually-set title attribute

The title attribute I referred to is set on the link (not the image). There is no form field for it in WordPress' media editor, so it is generally only present when the HTML code is manually edited.

For example:

<a href="image.png" title="Manually-set title">...</a>

Theme compatibility

SLB currently supports modern standards-compliant themes that support HTML5 markup. Evaluating support for legacy themes is on the to-do list, but it is not a high priority as old/outdated themes also have other issues to deal with (security, bugs, browser compatibility, etc.).

Adding the following to the theme's functions.php file will enable caption support by SLB, but it may also result in unexpected behavior with legacy themes:

add_theme_support( 'html5', array( 'gallery', 'caption' ) );

This is one of the reasons that the theme used on https://this-is-rpg.com/simulation-rpg/9540/ shows the "Alternative Text" value in the lightbox rather than the caption. The theme is rendering the caption on the page using a legacy method, which SLB does not support.

CDN

The other reason that the caption is not shown in the lightbox on this-is-rpg.com is because the image links are being rewritten to point to a CDN (appears to be Jetpack's CDN on this site).

Some CDN providers (such as Jetpack) modify the image link URLs before other plugins can process the links in the post, preventing the retrieval of the caption/title metadata from the site's media library. You can confirm this by temporarily disabling the CDN functionality on the site, clearing all caches, and testing the links again to see if the captions are properly displayed.

Support for such CDN providers would require an extension.

Summary

In summary, the keys for full compatibility with SLB are:

You can narrow down the specific causes of any issues by following these instructions on troubleshooting plugin/theme conflicts.

You can report any plugin/theme conflicts you find and I will see what can be done from SLB's end to resolve them.

NEET-MAN25 commented 1 year ago

ご返信とご対応に感謝します!

functions.php

add_theme_support( 'html5', array( 'gallery', 'caption' ) );

と追加したところ正常に機能しました!

NEET-MAN25 commented 1 year ago

このプラグインは性能も対応も素晴らしいですね!

本当にありがとうございました!

これからも使い続けます!

できればPayPalで寄付を募ってください!

archetyped commented 1 year ago

Glad to hear your issue was resolved! 🤙🏽