嗨,我正在尝试编辑视觉作曲家插件,特别是一个默认的元素“单一图像”。
我希望能够添加一个可以为图片添加alt标签的部分-因为我使用标准的wordpress alt标签在不同的页面上多次使用某些图片,这意味着我需要多次上传图片。
我在其他网站上使用过visual composer,这是由主题作者定制的,它已经有了这个功能,但我似乎无法让它在标准的visual composer上工作。
我将以下代码添加到PHP文件中:
array(
'type' => 'textfield',
'heading' => __( 'Image ALT tag', 'js_composer' ),
'param_name' => 'image_alt',
'holder' => 'alt',
'description' => __( 'Enter the image alt text.', 'js_composer' ),它可以添加alt标签文本框,但不能转换到前端,在前端,它仍然从媒体库中添加的title标签中拉出alt标签。
我是不是在这里遗漏了一个函数或什么?
发布于 2018-01-06 21:51:57
编辑此文件:
js_composer/include/templates/shortcodes/vc_single_image.php添加下面这行:
$img['thumbnail'] = str_replace( '<img ', '<img alt="' . $image_alt . '" ', $img['thumbnail'] );在此行之前的某个位置:
$wrapperClass = 'vc_single_image-wrapper ' . $style . ' ' . $border_color;https://stackoverflow.com/questions/47711028
复制相似问题