2010-02-09 136 views
0

嗨php wordpress人,内联编辑器插件的wordpress外部JavaScript文件?

我正在使用内联编辑器插件的wordpress 我知道,为了seo的目的,最好确保这些是外部文件。 当我在浏览器中查看源代码时,可以看到内嵌编辑器插件的JavaScript显示在页面代码中。

有没有办法让这个外部的js文件,在wordpress框架内,或者它将不得不在插件的工作页面之内?

感谢您的帮助

问候 朱迪

任何人都知道这是从正在添加?我在其他网站上看不到它,所以它必须来自不同的插件?

<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> 

回答

0

这将由插件的作者编写它的方式引起,最简单的选择是与作者取得联系并查看插件是否仍然保留并询问他们是否会考虑将javascript移到一个外部样式表。

如果你想自己做,那么你就没有理由不能删除内联代码并创建一个外部JavaScript文件来包含在页面中,但这需要你在修改插件时有信心对于wordpress将其移动到外部样式表并不容易。

0

它看起来像你问是否WordPress可以处理使用外部JS文件,而不是将其嵌入到脚本标记之间。如果这是你的问题,那么,只要打开你的主题header.php文件,包括使用该文件:

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

与任何其他脚本包含。 WordPress可以正常工作。

+0

是的,但代码是不是在插件中的主题? – 2010-02-09 23:10:59

+0

我知道如何为主题创建外部文件,但为什么当我在浏览器中查看源代码时,插件将它添加到页面中? – 2010-02-09 23:12:24