Midwestsalt.net > 查看源代码 它在整个站点中看起来像这样。没有意义 到处都有这些换行符很难调试!我不确定为什么会发生这种情况。SO说要添加更多细节,这是我对问题的了解最多。看到这里的 php 很好,源代码变得疯狂,我无法调试它。
<?php
/**
* The Header for our theme.
*
* @package WordPress
* @subpackage MidwestSalt
*/
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if IE 6]>
<html id="ie6" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]>
<html id="ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html xmlns="http://www.w3.org/1999/xhtml">
<!--<![endif]-->
<head>
<?php /*?><meta charset="<?php bloginfo( 'charset' ); ?>" /><?php */?>
<meta http-equiv=content-type content=text/html; charset="utf-8"/>
<meta name="viewport" content="width=device-width" />
<title>
<?php /* * Print the <title> tag based on what is being viewed. */ global $page, $paged; wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ); ?>
</title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" type="image/ico" />
<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
*/
wp_head();
?>
<?php
global $post;
global $curr_cat;
global $wpdb;
global $product_categories;
global $maincatname;
$curr_cat = get_current_category();
$maincatname = get_viewmode();
if (!$maincatname)
$maincatname = 'homeowners';
$maincat = get_category_by_name($maincatname);
$where_maincat = ' AND parent = '.$maincat->term_id;
$product_categories = $wpdb->get_results("
SELECT *,
(SELECT meta_value FROM wp_wpsc_meta WHERE object_type = 'wpsc_category' AND meta_key = 'image' AND object_id = term_id) AS image
FROM wp_terms
WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy = 'wpsc_product_category' $where_maincat)
AND term_id IN (SELECT object_id FROM wp_wpsc_meta WHERE object_type = 'wpsc_category' AND meta_key = 'active' AND meta_value = '1')
");
?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/prettyPhoto.css" media="screen" />
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.prettyPhoto.js"> </script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/fadeSlideShow-minified.js"> </script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.masonry.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/allscripts.js"></script>
</head>
<body class="<?php if ($post->ID == 2 || $post->ID == 136 || $post->ID == 139) echo 'landing'; elseif($curr_cat) echo 'product-listing'; elseif($post->post_type=='post') echo 'blog-view'; elseif(is_category()) echo 'blog-listing'; else echo 'catalog-product-view';?> <?php echo $maincatname; ?>">
<noscript>
<div class="noscript">
<div class="noscript-inner">
<p><strong>We detected that your JavaScript seem to be disabled.</strong></p>
<p>You must have JavaScript enabled in your browser to utilize the functionality of this website.</p>
</div>
</div>
</noscript>
<div class="main-wrapper">
<div class="main-header-wrapper">
<div class="header">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="logo"><strong><?php bloginfo( 'name' ); ?> - <?php bloginfo( 'description' ); ?></strong></a>
<div class="header-right">
<ul class="main-nav">
<li id="nav-home"><a href="<?php echo get_option('home');?>"><strong>Home</strong></a></li>
<li id="nav-about">
<a href="<?php echo get_option('home');?>/about-us"><strong>About us</strong></a>
<?php
$items = get_block_items('show_in_header','Yes');
if ($items): ?>
<ul class="dropdown">
<?php foreach($items as $item): ?>
<li><a href="<?php echo get_permalink($item->ID)?>"><?php echo $item->post_title?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<li id="nav-products">
<a href="<?php product_page_link(); ?>"><strong>Products</strong></a>
<ul class="product-dropdown">
<?php foreach($product_categories as $item): ?>
<?php if ($item->slug == 'product-category') continue; ?>
<li><a href="<?php product_page_link(); ?><?php echo $item->slug;?>"><img width="136" height="85" alt="" src="<?php echo ne_image_resize(get_option('home').'/wp-content/uploads/wpsc/category_images/'.$item->image,136,85,'category_images'); ?>" /><span><?php echo strtoupper($item->name)?></span></a></li>
<?php endforeach; ?>
</ul>
</li>
<li id="nav-contact"><a href="<?php echo get_option('home');?>/contact-us"><strong>Contact us</strong></a></li>
</ul>
<a href="<?php echo get_option('home');?>" class="btn-chat"><strong>Live chat - click here</strong></a>
<?php language_selector_form(); ?>
<div class="clear"> </div>
<ul class="user-nav">
<li><a href="#">Login</a></li>
<li>|</li>
<li><a href="#">My account</a></li>
</ul>
<p class="block-cart"><span>0</span> items in cart</p>
<p class="contact-info"><?php _get('header_phone',2); ?> <span><?php _get('header_location',2); ?></span></p>
<div class="clear"> </div>
<?php /*
<p class="slogan">WE DO ALL THE HEAVY LIFTING FOR YOU</p>
*/ ?>
<a href="<?php echo get_option('home');?>/refer-a-friend" class="btn-refer"><strong>refer friends</strong></a>
<?php if ($_link = _get('existing_customers_link',2,true)): ?>
<?php if ($_image = _get_image('existing_customers_image',2,true)): ?>
<a href="<?php echo $_link; ?>" class="btn-existing"><img src="<?php echo $_image; ?>" /><strong>existing customers</strong></a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<!-- end: header -->
</div>
<!-- end: main-header-wrapper -->
那么有什么想法为什么?