WordPress 内联编辑器插件的外部 javascript 文件?

发布于 2024-08-21 14:27:34 字数 1866 浏览 7 评论 0原文

嗨 php WordPress 的人们,

我正在使用 WordPress 的内联编辑器插件 我知道出于搜索引擎优化的目的,最好确保这些是外部文件。 当我在浏览器中查看源代码时,我可以看到内联编辑器插件的 javascript 显示在页面代码中。

有没有办法使它成为 WordPress 框架内的外部 js 文件,或者它必须位于页面内才能使插件工作?

感谢您的帮助

问候 judi

有人知道这是从哪里来的吗?我在其他网站上没有看到它,所以它一定来自不同的插件?

<script type="text/javascript">
/* <![CDATA[ */
    var ileNicEditor;
    function startEditing(postId) {
        jQuery("#ileEditLink"+postId).hide(); 
        jQuery("#ileEditButton-"+postId).hide();
        jQuery("#ileCancelButton-"+postId).show();
        ileCreateNicEditor(postId);
    }
    function ileCreateNicEditor(postId) {
        jQuery.ajax({async:false,
                     type:"POST",
                     url:"http://fr.com/wp-content/plugins/inline-editor/ajax-content.php",
                     data:"id="+postId,
                     success:function(data){
                        jQuery("#ileContent-"+postId).html(data);
                     }
                     });
        ileNicEditor = new nicEditor({fullPanel:true,
                                      iconsPath:"http://fr.com/wp-content/plugins/inline-editor/nicEditorIcons.gif",
                                      onSave:function(content,id,instance){ileSave(postId,content)}
                                     }).panelInstance("ileContent-"+postId,{hasPanel:true});;
        jQuery("#ileCancelButton"+postId).show();
    }
    function ileSave(postId,content){
        jQuery.post("http://fr.com/wp-content/plugins/inline-editor/ajax-save.php",
                    {"id":postId,
                     "content":content},
                     function(data){
                         alert(data.message)
                         jQuery("#ileCancelButton-"+postId).click();
                     },
                     "json");
    }
/* ]]> */

</script>

Hi php wordpress people,

I'm using inline editor plugin for wordpress
I am aware that for seo purposes it is best to make sure these are external files.
When I view the source in my browser I can see the javascript for inline editor plugin is displayed in the page code.

Is there a way to make this an external js file, within the wordpress framework, or will it have to be within the page for the plugin to work?

thanks for your help

Regards
judi

Anyone know where this is comming from? I don't see it on my other websites so it must be from a different plugin?

<script type="text/javascript">
/* <![CDATA[ */
    var ileNicEditor;
    function startEditing(postId) {
        jQuery("#ileEditLink"+postId).hide(); 
        jQuery("#ileEditButton-"+postId).hide();
        jQuery("#ileCancelButton-"+postId).show();
        ileCreateNicEditor(postId);
    }
    function ileCreateNicEditor(postId) {
        jQuery.ajax({async:false,
                     type:"POST",
                     url:"http://fr.com/wp-content/plugins/inline-editor/ajax-content.php",
                     data:"id="+postId,
                     success:function(data){
                        jQuery("#ileContent-"+postId).html(data);
                     }
                     });
        ileNicEditor = new nicEditor({fullPanel:true,
                                      iconsPath:"http://fr.com/wp-content/plugins/inline-editor/nicEditorIcons.gif",
                                      onSave:function(content,id,instance){ileSave(postId,content)}
                                     }).panelInstance("ileContent-"+postId,{hasPanel:true});;
        jQuery("#ileCancelButton"+postId).show();
    }
    function ileSave(postId,content){
        jQuery.post("http://fr.com/wp-content/plugins/inline-editor/ajax-save.php",
                    {"id":postId,
                     "content":content},
                     function(data){
                         alert(data.message)
                         jQuery("#ileCancelButton-"+postId).click();
                     },
                     "json");
    }
/* ]]> */

</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

溺渁∝ 2024-08-28 14:27:34

这将是由插件作者编写的方式引起的,最简单的选择是与作者联系,看看该插件是否仍在维护,并询问他们是否会考虑将 javascript 移动到外部样式表。

如果您想自己做,那么您没有理由不能删除内联代码并创建一个外部 javascript 文件以包含在页面中,但这需要您对修改插件有信心,因为没有简单的方法让 wordpress 将其移动到外部样式表。

This will be caused by the way the author of the plugin has wrote it, the simplest option would be to get in touch with the author and see if the plugin is still maintained and ask if they would consider moving the javascript to an external stylesheet.

If you want to do it yourself then there would be no reason why you could not remove the inline code and create an external javascript file to include in the page but this would require you to feel confident with modifying the plugin as there is no easy way for wordpress to move it to an external stylesheet.

红焚 2024-08-28 14:27:34

看起来您是在问 WordPress 是否可以使用外部 JS 文件来处理,而不是将其嵌入脚本标签之间。如果这是您的问题,那么是的,只需打开主题的 header.php 并使用以下命令包含该文件:

<script src="http://other-site.com/script.js" type="text/javascript"></script>

与任何其他脚本包含相同。 WordPress 可以很好地处理这个问题。

It looks like you're asking if WordPress can handle using an external JS file instead of embedding it between script tags. If that's your question, then yes, just open your theme's header.php and include the file using:

<script src="http://other-site.com/script.js" type="text/javascript"></script>

Same as any other script include. WordPress will work fine with that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文