为什么我的 WordPress PHP 标头模板会生成奇怪的编码路径并在输出的 HTML 中包含一些 css 和 js 文件?
我认为这是一个编码问题(?),但不太确定。
当我查看生成的源代码(在 FF 和 IE 中)时,我看到来自 js 和 css 文件的时髦路径,例如:
此外,一些 js/css 文件实际上被嵌入,即我没有看到对外部文件的引用,而是这些文件的内容显示在 和
内部的源代码中分别标记。我以前从未见过这种行为,感到非常困惑。
这是我的 header.php 文件的开始方式:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php if (is_front_page() ) {
bloginfo('name');
} elseif ( is_category() ) {
single_cat_title(); echo ' - ' ; bloginfo('name');
} elseif (is_single() ) {
single_post_title();
} elseif (is_page() ) {
single_post_title(); echo ' - '; bloginfo('name');
} else {
wp_title('',true);
} ?>
</title>
<?php if(get_option('favicon')) { ?>
<link rel="shortcut icon" href="<?php echo get_option('favicon'); ?>" type="image/x-icon" />
<?php }else{?><link rel="shortcut icon" href="<?php echo system32_url; ?>/favicon.ico" type="image/x-icon" /> <?php } ?>
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_url'); ?>/css/reset.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style.css" />
<!-- Jquery and Easing-->
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.easing.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.capSlide.js"></script>
这是我看到的输出:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang=en lang=en>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"/>
<title>Surf Hatteras</title>
<link rel="shortcut icon" href="http://www.surfhatteras.com/wp-content/uploads/2010/10/surf-icon.gif" type="image/x-icon"/>
<style>body { outline:none;}
.postoptions { padding:0px; padding-top:0; }
.postoptions select,
...
</style>
<style>/* CSS for WP-Testimonials */
#sfstest-form label {
float: left;
width: 200px;
font-weight: bold;
}
...
</style>
<script type='text/javascript' src='http://www.surfhatteras.com/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<link rel=EditURI type="application/rsd+xml" title=RSD href="http://www.surfhatteras.com/xmlrpc.php?rsd"/>
<link rel=wlwmanifest type="application/wlwmanifest+xml" href="http://www.surfhatteras.com/wp-includes/wlwmanifest.xml"/>
<link rel=index title='Surf Hatteras' href='http://www.surfhatteras.com/'/>
<meta name=generator content="WordPress 3.0.1"/>
<style>/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
...
</style>
<link rel=stylesheet type="text/css" href="http://www.surfhatteras.com/wp-content/themes/dudical/ce.51cd742ab6418eec6131ff2cf43b61c4.style,s.css"/>
<!-- Jquery and Easing-->
<script type="text/javascript" src="http://www.surfhatteras.com/wp-content/themes/dudical/js/ce.9e936b27d8d0e4e07ebef242d7c6e2cc.jquery-1,o4,omin,l.js"></script>
<script type="text/javascript">(function($) {
$.fn.capslide = function(options) {
var opts = $.extend({}, $.fn.capslide.defaults, options);
return this.each(function() {
$this = $(this);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
...
})(jQuery);</script>
<link rel=stylesheet type="text/css" href="http://www.surfhatteras.com/wp-content/themes/dudical/colors/ce.d47db6d7bbcb1f0192576f60ffa27ec9.white,s.css" media=screen />
<!-- Slider CSS-->
<style>/*
Coin Slider jQuery plugin CSS styles
http://workshop.rs/projects/coin-slider
*/
#coin-slider { margin-left:20px;}
...
</style>
<link rel=stylesheet type="text/css" media=screen href="http://www.surfhatteras.com/wp-content/themes/dudical/css/cc.224c1b363a793961fc7bc2e428d6ce58.nivo-slider,s+superfish,s.css">
无法弄清楚我的路径发生了什么,或者为什么某些外部文件被这样对待...
编辑
列表我正在使用的插件:
- Category Posts Widget
- Contact Form 7
- Contact Form 7 to DB Extension
- Get Post Image
- 获取图像
- 上传时调整大小 Plus
- Widgets Reloaded
- WordPress Hashcash
- WP-DBManager
- WP-Mail-SMTP
- WP Show IDs
- WP Wunderground
- (缓存我使用的插件是 Quick Cache)
I think this is an encoding problem(?), but not really sure.
When I view my generated source (in both FF and IE) I see funky paths from my js and css files like: <script type="text/javascript" src="http://www.domain.com/wp-content/themes/dudical/js/ce.f4195499d3cfc40ae09588aae02ff2dc.jquery,oeasing,omin,l.js"></script>
Also, several of the js/css files are actually being transcluded, i.e I don't see references to the external files, but instead the content of those files are being shown in the source inside of <script>
and <style>
tags respectively. I've never seen this type of behavior before and am pretty baffled.
Here is how my header.php file begins:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php if (is_front_page() ) {
bloginfo('name');
} elseif ( is_category() ) {
single_cat_title(); echo ' - ' ; bloginfo('name');
} elseif (is_single() ) {
single_post_title();
} elseif (is_page() ) {
single_post_title(); echo ' - '; bloginfo('name');
} else {
wp_title('',true);
} ?>
</title>
<?php if(get_option('favicon')) { ?>
<link rel="shortcut icon" href="<?php echo get_option('favicon'); ?>" type="image/x-icon" />
<?php }else{?><link rel="shortcut icon" href="<?php echo system32_url; ?>/favicon.ico" type="image/x-icon" /> <?php } ?>
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_url'); ?>/css/reset.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style.css" />
<!-- Jquery and Easing-->
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.easing.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.capSlide.js"></script>
Here is what I see output:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang=en lang=en>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"/>
<title>Surf Hatteras</title>
<link rel="shortcut icon" href="http://www.surfhatteras.com/wp-content/uploads/2010/10/surf-icon.gif" type="image/x-icon"/>
<style>body { outline:none;}
.postoptions { padding:0px; padding-top:0; }
.postoptions select,
...
</style>
<style>/* CSS for WP-Testimonials */
#sfstest-form label {
float: left;
width: 200px;
font-weight: bold;
}
...
</style>
<script type='text/javascript' src='http://www.surfhatteras.com/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<link rel=EditURI type="application/rsd+xml" title=RSD href="http://www.surfhatteras.com/xmlrpc.php?rsd"/>
<link rel=wlwmanifest type="application/wlwmanifest+xml" href="http://www.surfhatteras.com/wp-includes/wlwmanifest.xml"/>
<link rel=index title='Surf Hatteras' href='http://www.surfhatteras.com/'/>
<meta name=generator content="WordPress 3.0.1"/>
<style>/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
...
</style>
<link rel=stylesheet type="text/css" href="http://www.surfhatteras.com/wp-content/themes/dudical/ce.51cd742ab6418eec6131ff2cf43b61c4.style,s.css"/>
<!-- Jquery and Easing-->
<script type="text/javascript" src="http://www.surfhatteras.com/wp-content/themes/dudical/js/ce.9e936b27d8d0e4e07ebef242d7c6e2cc.jquery-1,o4,omin,l.js"></script>
<script type="text/javascript">(function($) {
$.fn.capslide = function(options) {
var opts = $.extend({}, $.fn.capslide.defaults, options);
return this.each(function() {
$this = $(this);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
...
})(jQuery);</script>
<link rel=stylesheet type="text/css" href="http://www.surfhatteras.com/wp-content/themes/dudical/colors/ce.d47db6d7bbcb1f0192576f60ffa27ec9.white,s.css" media=screen />
<!-- Slider CSS-->
<style>/*
Coin Slider jQuery plugin CSS styles
http://workshop.rs/projects/coin-slider
*/
#coin-slider { margin-left:20px;}
...
</style>
<link rel=stylesheet type="text/css" media=screen href="http://www.surfhatteras.com/wp-content/themes/dudical/css/cc.224c1b363a793961fc7bc2e428d6ce58.nivo-slider,s+superfish,s.css">
Can't figure what is happening to my paths, or why some external files are getting treated as such...
EDIT
List of plug-ins I am using:
- Category Posts Widget
- Contact Form 7
- Contact Form 7 to DB Extension
- Get Post Image
- Get The Image
- Resize At Upload Plus
- Widgets Reloaded
- WordPress Hashcash
- WP-DBManager
- WP-Mail-SMTP
- WP Show IDs
- WP Wunderground
- (The caching plugin I was using is Quick Cache)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这没什么大不了的。
只是因为您使用了 Google Page Speed 扩展模块。
It's not a big deal.
Just because you have using Goolge Page Speed extension mod.