我在构建音频列表中使用wordpress,用于站点中的帖子。
Theres no html only this from wordpress
[playlist ids="1095,1111,1128,1130,1131,1136,1138,1155,1156,1157,1160,1161,1171"]
这是一个简单的请求。
Wordpress在所有歌曲标题中加入了一些逗号并且令人讨厌。看看这张照片。
有没有办法像使用jquery一样删除它们,或者在functions.php文件中添加一些函数。
我尝试过使用我发现的代码
<script type="text/javascript">
$('span.wp-playlist-item-title').blur(function() {
$(this).val($(this).val().replace(/"/g,''));
});
</script>
没有运气
答案 0 :(得分:1)
您需要&#34;翻译&#34; /编辑以下 gettext 字符串:
“%s”
仅限于以下上下文:
播放列表项目标题
例如,您可以通过WPML plugin(付费)或Loco Translate(它是免费的,但我还没有对其进行测试)这样做。
或者,使用My Custom Functions添加此PHP代码段,或者如果您感到舒服,请将其添加到主题 functions.php 文件中:
add_filter( 'gettext_with_context', function ( $translation, $text, $context, $domain ) {
if ( 'default' === $domain &&
'playlist item title' === $context &&
'“%s”' === $text ) {
return '%s';
}
return $translation;
}, 10, 4 );
请务必删除您在该页面上添加的JS代码。