奇怪的Wordpress错误 - 服务器问题/ htaccess / functions.php

时间:2011-02-13 09:14:46

标签: php wordpress

任何人都知道为什么这个URL能够完美运行: http://plumcreekgarlic.com/

但是这个网址会导致Wordpress错误? http://www.plumcreekgarlic.com/

这是Wordpress问题还是服务器/记录/ htaccess问题?

谢谢!

myHTAccess文件:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

我的functions.php文件(我构建的主题子主题的一部分):

/* ADD CUSTOM JQUERY */

function childtheme_scripts() {?>
    <script type="text/javascript" src="http://plumcreekgarlic.com/wp-content/themes/plumcreek/custom_jquery.js"></script>
<?php }
add_action('wp_head','childtheme_scripts');
?>

<?php
/* ADJUST CATEGORY TITLES 
Info here: http://www.cozmoslabs.com/forums/topic/change-title-for-category-archive
*/
function street_page_title() {
        $content = '';
        if (is_attachment()) {
                $content .= '<h2 class="page-title"><a href="';
                $content .= get_permalink($post->post_parent);
                $content .= '" rev="attachment"><span class="meta-nav">&laquo; </span>';
                $content .= get_the_title($post->post_parent);
                $content .= '</a></h2>';
        } elseif (is_author()) {
                $content .= '<h1 class="page-title author">';
                $author = get_the_author();
                $content .= __('Author Archives: ', 'thematic');
                $content .= '<span>';
                $content .= $author;
                $content .= '</span></h1>';
        } elseif (is_category()) {
                $content .= '<h1 class="entry-title">';
                $content .= __('', 'thematic');
                $content .= ' <span>';
                $content .= single_cat_title('', FALSE);
                $content .= '</span></h1>' . "\n";
                $content .= '<div class="archive-meta">';
                if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif;
                $content .= '</div>';
        } elseif (is_search()) {
                $content .= '<h1 class="page-title">';
                $content .= __('Search Results for:', 'thematic');
                $content .= ' <span id="search-terms">';
                $content .= wp_specialchars(stripslashes($_GET['s']), true);
                $content .= '</span></h1>';
        } elseif (is_tag()) {
                $content .= '<h1 class="page-title">';
                $content .= __('Tag Archives:', 'thematic');
                $content .= ' <span>';
                $content .= __(thematic_tag_query());
                $content .= '</span></h1>';
        }   elseif (is_day()) {
                $content .= '<h1 class="page-title">';
                $content .= sprintf(__('Daily Archives: <span>%s</span>', 'thematic'), get_the_time(get_option('date_format')));
                $content .= '</h1>';
        } elseif (is_month()) {
                $content .= '<h1 class="page-title">';
                $content .= sprintf(__('Monthly Archives: <span>%s</span>', 'thematic'), get_the_time('F Y'));
                $content .= '</h1>';
        } elseif (is_year()) {
                $content .= '<h1 class="page-title">';
                $content .= sprintf(__('Yearly Archives: <span>%s</span>', 'thematic'), get_the_time('Y'));
                $content .= '</h1>';
        } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
                $content .= '<h1 class="page-title">';
                $content .= __('Blog Archives', 'thematic');
                $content .= '</h1>';
        }
        $content .= "\n";
return $content;

}
add_filter('thematic_page_title', 'street_page_title');
?>

1 个答案:

答案 0 :(得分:2)

我找到了这个帖子http://wordpress.org/support/topic/cannot-modify-header-information-pluggablephp-on-line-865?replies=9

如果在起始<?php标记之前和?>结束标记之后有空格,则会检查functions.php。

引用Shane G

  
      
  1. 下载错误消息中提到的文件。
  2.   
  3. 在纯文本编辑器中打开该文件
  4.   
  5. 检查第一个字符是否正确   
  6. 检查最后一个字符是什么?&gt;
  7.   
  8. 将光标放在?之间?和&gt;
  9.   
  10. 现在按计算机上的DELETE键并按住该键   至少15秒。
  11.   
  12. 现在输入&gt;和
  13.   
  14. 在不按任何其他键的情况下保存。
  15.   

如果这解决了它,那么这是一个WordPress问题。您可能有一个插件使用www.plumcreekgarlic.com将用户重定向到plumcreekgarlic.com,但是当错误显示时,在输出已经开始时无法发送标题信息(位置)。

如果你有这样的插件,请删除它并使用htaccess to redirect users

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]