我正在使用media-upload.php?type=image&tab=library
脚本将图像添加到包含html描述的帖子中。此php脚本使用javascript函数window.send_to_editor
将html发送到页面。这允许您在帖子中插入图像html。
问题是,如果您尝试添加一个描述中包含多行文字(html)的图像,您将得到unterminated string literal
javascript b/c错误字符串在使用前未正确转换。
这附近有什么吗?
我正在使用media-upload.php?type=image&tab=library
脚本将图像添加到包含html描述的帖子中。此php脚本使用javascript函数window.send_to_editor
将html发送到页面。这允许您在帖子中插入图像html。
问题是,如果您尝试添加一个描述中包含多行文字(html)的图像,您将得到unterminated string literal
javascript b/c错误字符串在使用前未正确转换。
这附近有什么吗?
来自评论:
在字符串到达窗口之前,必须使用image\\u send\\u to\\u编辑器过滤器过滤字符串。send\\u to\\u editor javascript函数。
add_filter(\'image_send_to_editor\', \'my_image_send_to_editor\', 10, 2);
function my_image_send_to_editor($html, $id)
{
$description = str_replace("\\r\\n",\' \', $description);
}
我希望向特定的分类页面添加一些脚本和样式。例如,我希望只有属于“问题”自定义分类法的帖子才会显示横幅旋转器。我尝试使用is\\u tax(“问题”)来控制脚本和样式何时排队,但这似乎不起作用。这是我的函数示例。php文件:function init_customizations() { if (is_tax(\'issue\')) { wp_register_script(\'rotator_scripts\',get_bloginfo(\'template_directory