自定义 WP 图像编辑小部件 [英] Customizing the WP image editing widget

查看:29
本文介绍了自定义 WP 图像编辑小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编辑包含图像的帖子时,WP 会在图像上附加一个属性检查器图标,以允许编辑基本属性,例如大小、对齐方式、链接等.

While editing a post that contains an image, WP attaches a properties inspector icon over the image to allow editing basic properties such as size, alignment, link etc.

我想知道侵入这个对话框屏幕并向链接区域添加一些自定义程序会有多困难.

I'd like to know how difficult it would be to hack into this dialog screen and add some custom programming to the link area.

我想在那里添加一个弹出菜单,我可以通过点击一个按钮来访问它(在现有的链接到图像"按钮旁边.

I'd like to add a popup menu there that I can access with the click of a button (next to the existing "Link to Image" button.

我更喜欢通过我的主题文件夹中的文件或插件来连接到这个对话框.我不想改变 wordpress 代码本身(以使其更具便携性和特定于主题).

I'd prefer to hook into this dialog via a file in my theme's folder or via a plug-in. I don't want to alter the wordpress code itself (to allow this to be more portable and theme specific).

推荐答案

编辑图像弹出窗口是一个 TinyMCE 插件(Wordpress 使用的富文本编辑器),其文件位于 wp-includes/js/tinymce/plugins/wpeditimage/.

The edit image popup is a TinyMCE plugin (the rich text editor that Wordpress uses), the files for which are in wp-includes/js/tinymce/plugins/wpeditimage/.

因此,您不能简单地使用 Wordpress 插件 API 来修改它.您需要创建自己的 TinyMCE 插件,可能是通过复制 wpeditimage 插件并添加额外的功能.您还需要创建一个 Wordpress 插件来激活 TinyMCE 插件,有关在 Wordpress 中使用 TinyMCE 插件的更多信息,请参阅这些代码页面:

As such you can't simply use the Wordpress plugin API to modify it. You'd need to create your own TinyMCE plugin, probably by duplicating the wpeditimage plugin and adding your extra functionality. You'd also need to create a Wordpress plugin to activate the TinyMCE plugin, see these codex pages for more information on working with TinyMCE plugins in Wordpress:

这篇关于自定义 WP 图像编辑小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆