newcity/wp-wrap-images 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

newcity/wp-wrap-images

Composer 安装命令:

composer require newcity/wp-wrap-images

包简介

README 文档

README

Description

Wraps all images inserted into a WYSIWYG field from the Add Media interface with a <figure> element, even if no caption is assigned to the image. Compatible with the standard Wordpress tinyMCE editor and the Advanced Custom Fields WYSIWYG field type.

Installation Instructions

To install this plugin manually:

  1. Download the plugin .zip file
  2. Unzip
  3. Copy the Wrap WYSIWYG Images directory to your /wp-content/plugins directory
  4. Go to the plugin management page and activate the plugin

This plugin has no settings to configure -- once it is activated, it starts doing it's work immediately.

Why this plugin exists

Wordpress is inconsistent in its handling of images inserted into WYSIWYG editor fields. If the image has a caption, Wordpress wraps it in a shortcode that in turn wraps the <img> tag in a <figure> tag with an included <figcaption> tag.

Example Image with Caption Output

<figure id="attachment_508" style="width: 300px" class="wp-caption alignnone">
  <img ... />
  <figcaption class="wp-caption-text">This is a caption</figcaption>
</figure>

If no caption is present, the image is unceremoniously dumped into the page with no wrapper. This presents a challenge for theme designers, since targeting the <figure> tag or the <img> tag with CSS will yield different results.

How it works

This plugin uses the the_content and acf_the_content hooks to wrap images without captions in the [caption] shortcode before the page is built. It also replaces Wordpress' default caption shortcode function with a slightly modified version that does not ignore captionless images. The result is that uncaptioned images receive exactly the same markup wrappers as captioned images, but without the <figcaption> element.

Possible conflicts

This plugin adds its replacement [caption] filter to img_caption_shortcode, and will conflict with any custom caption shortcode you may have already assigned via img_caption_shortcode. This plugin's filter is assigned with a priority of 10, so if you want to use this plugin in combination with a different caption override filter you should assign the other filter a priority value greater than 10.

Support

This plugin is provided without warranty or formal support. To ask questions of the developer, send an email to geeks@insidenewcity.com.

Please submit bugs, patches, and feature requests to
https://github.com/newcity/wp-wrap-images

newcity/wp-wrap-images 适用场景与选型建议

newcity/wp-wrap-images 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 85 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 newcity/wp-wrap-images 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 newcity/wp-wrap-images 我们能提供哪些服务?
定制开发 / 二次开发

基于 newcity/wp-wrap-images 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 85
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-04-11