-3

重複の可能性:
PHP によって既に送信されたヘッダー

www.newswars.org で wp-admin にアクセスすると、次のエラーが表示されます。

警告: ヘッダー情報を変更できません - /home/newswars/public_html/wp-includes/option 内の (/home/newswars/public_html/wp-content/themes/videoplus/functions.php:38 で開始された出力) によって既に送信されたヘッダー。 563行目のphp

警告: ヘッダー情報を変更できません - /home/newswars/public_html/wp-includes/option 内の (/home/newswars/public_html/wp-content/themes/videoplus/functions.php:38 で開始された出力) によって既に送信されたヘッダー。 564行目のphp

助けていただけますか?

編集:これが問題の原因です。

$user_ej = wp_get_current_user();
if ($user_ej->roles[0] == 'contributor')
{ ?>

これは 36 ~ 38 行です。何らかの理由で、すべてが台無しになります。それでも、何が問題なのかよくわかりません。?> を削除しようとしましたが、構文エラーが発生しました。私は途方に暮れています。誰かが「貢献者」にログインしたときにのみ表示されるため、これは間違いなく問題の領域です。

 <?php
// Translations can be filed in the /lang/ directory
load_theme_textdomain( 'themejunkie', TEMPLATEPATH . '/lang' );


require_once(TEMPLATEPATH . '/includes/sidebar-init.php');
require_once(TEMPLATEPATH . '/includes/custom-functions.php');
require_once(TEMPLATEPATH . '/includes/post-thumbnails.php');

require_once(TEMPLATEPATH . '/includes/theme-postmeta.php');

require_once(TEMPLATEPATH . '/includes/theme-options.php');
require_once(TEMPLATEPATH . '/includes/theme-widgets.php');

require_once(TEMPLATEPATH . '/functions/theme_functions.php'); 
require_once(TEMPLATEPATH . '/functions/admin_functions.php');
function wpr_snap($atts, $content = null) {
        extract(shortcode_atts(array(
            "snap" => 'http://s.wordpress.com/mshots/v1/',
            "url" => 'http://www.catswhocode.com',
            "alt" => 'My image',
            "w" => '400', // width
            "h" => '300' // height
        ), $atts));

    $img = '<img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $alt . '"/>';
        return $img;
}




add_shortcode("snap", "wpr_snap");

$user_ej = wp_get_current_user();
if ($user_ej->roles[0] == 'contributor')
{ ?>
    <style type="text/css">
        #menu-dashboard, #toplevel_page_wpcf7, #menu-tools 
        {
            display:none;
        }
  </style>





<?php }

add_filter(  'gettext',  'change_post_to_portfolio'  );
add_filter(  'ngettext',  'change_post_to_portfolio'  );

function change_post_to_portfolio( $translated ) {
  $translated = str_ireplace(  'Posts',  'VIDEOS',  $translated );  // ireplace is PHP5 only
  return $translated;
}

// Uncomment this to test your localization, make sure to enter the right language code.
// function test_localization( $locale ) {
//  return "nl_NL";
// }
// add_filter('locale','test_localization');

// Adds categories to pages
add_action('admin_init', 'reg_tax');
function reg_tax() {
register_taxonomy_for_object_type('category', 'page');
add_post_type_support('page', 'category');
}

add_action('admin_footer', 'my_admin_footer');
function my_admin_footer()
{
    $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : NULL ;

    $message = NULL;

    if ($uri AND strpos($uri,'edit.php'))
    {
        if (strpos($uri,'post_type=page'))
        {
            $message = '1.In the ‘Video Embed Code section,’ enter the video embed code. 2.Enter the title and text in the main panel below. 3.Choose which continent and category is most fitting for your video. 4.Press ‘Publish’';
        }
        else
        {
            $message = 'ALL VIDEOS';
        }
    }

    elseif ($uri AND strpos($uri,'post-new.php'))
    {
        if (strpos($uri,'post_type=page'))
        {
            $message = 'Add pages here';
        }
        else
        {
            $message = '1.In the ‘Video Embed Code section,’ enter the video embed code. 2.Enter the title and text in the main panel below. 3.Choose which continent and category is most fitting for your video. 4.Press ‘Publish’';
        }
    }

    elseif ($uri AND strpos($uri,'post.php'))
    {
        $message = 'THREE';
    }

    if ($message)
    {
        ?><script>
            jQuery(function($)
            {
                $('<div style="margin-bottom:15px; color:#FF0000;"></div>').text('<?php echo $message; ?>').insertAfter('#wpbody-content .wrap h2:eq(0)');
            });
        </script><?php
    }
}
?>
4

1 に答える 1

0
add_shortcode("snap", "wpr_snap");
$user_ej = wp_get_current_user();
if ($user_ej->roles[0] == 'contributor')
{ ?>
  <style type="text/css">
    #menu-dashboard, #toplevel_page_wpcf7, #menu-tools 
    {
        display:none;
    }
</style>
<?php }
add_filter(  'gettext',  'change_post_to_portfolio'  );
add_filter(  'ngettext',  'change_post_to_portfolio'  );

isn't inside a function. So it's being called as soon as the file loads. This means all output is sent to the screen immediately This stuff should be inside a function which is then called at the right time (like the other bits).

于 2012-10-20T16:34:31.063 に答える