WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Spectrum Theme: usual method to solve "headers already sent" error fails. (4 posts)

  1. aloeroot
    Member
    Posted 4 years ago #

    Hi there folks. I'm trying to use the exec-php plugin to embed this redirect in a WordPress page:

    <?php
    ini_set('display_errors','1');
    ini_set('display_startup_errors','1');
    error_reporting (E_ALL);
    header( 'Location: ../../index.php' ) ;
    ?>

    However I'm getting the dreaded Errors Already Sent warning:

    Warning: Cannot modify header information – headers already sent by (output started at /home/chubby/public_html/askchubbygirl/wp-content/themes/spectrum/header.php:6) in /home/chubby/public_html/askchubbygirl/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 5

    The entire contents of my header.php page is as follows. I've made a couple edits, namely adding the custom meta tags, adding the twittercode.php include at the bottom and hardcoding a URL to a different style sheet. I can't find any issues with whitespace on line six of this file, though. Help please?:

    <?php
    /**
     * @package WordPress
     * @subpackage Spectrum
     */?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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 wp_title('&laquo;', true, 'right'); ?><?php bloginfo('name'); ?></title>
    		<link rel="stylesheet" href="http://76.74.228.103/~chubby/wp-content/themes/spectrum/style.css" type="text/css" media="screen" />
    		<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/ie.css" type="text/css" media="screen" />
    		<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
    		<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-min.js"></script>
    		<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/spectrum-min.js"></script>
    		<link rel="shortcut icon" href="favicon.ico" />
    		<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    		<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    		<?php wp_head(); ?>
    		<meta name="keywords" content="amanda, nogle, mandee, chubby, girl, comics, comic, strip, comics by email, comics sherpa, belly dancing, fairchild, michaela, speech therapist, therapy center, animal rescue, dog trainer, counsellor, colourist, philosopher, physician, max, edmond, mrs myew, pets, belly dancing, work, office, exercise, workout" />
    <meta name="description" content="Official website for the Chubby Girl comic strip by ManDee Nogle." />
    	</head>
    
    	<body <?php body_class(); ?>>
    
    		<div id="header">
    			<div id="logo">
    				<h1>
    					<a href="../index.php"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" /></a>
    				</h1>
    			</div>
    			<div id="subscribe">
    				<a href="<?php bloginfo('rss2_url'); ?>" title="Subscribe to <?php bloginfo('name'); ?> RSS">Subscribe to <?php bloginfo('name'); ?> RSS</a>
    			</div>
    			<div class="pageList">
    				<ul>
    					<?php wp_list_pages('title_li=&depth=1'); ?>
    				</ul>
    			</div>
    		</div>
    		<div id="mainWrap">
    			<div id="main">
    				<div id="siteDescription">
    					<?php include "../twittercode.php"; ?></div>
    <div id="content">
  2. esmi
    Forum Moderator
    Posted 4 years ago #

    You can't embed a header re-direct into a WordPress Page for the obvious reason that, by the time the Page content is parsed, header.php has already been parsed.

    Try using the Page Links To plugin instead.

  3. aloeroot
    Member
    Posted 4 years ago #

    Stupid question of the week...thanks for your help.

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Nah - seen far dafter... ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic