Cannot modify header information – headers already sent by…

I recently came across this Error/Warning “Cannot modify header information – headers already sent by…” while I was trying to use one of the free themes provided by a premium theme provider. <shame>

After a little bit of googling I found out that many people have experienced this problem and had posted different solutions.

Below is the solution which I found useful and which worked for me.

1. In the functions.php file just as the <? php tag start paste this “ob_start();” and update your code.

Example:

{code type=php}

<?php
ob_start(); /* Here is where you add it ! */
/*———————————————————————————–*/
/* Start yrusThemes Functions – Please refrain from editing this section */
/*———————————————————————————–*/

// Set path to yrusFramework and theme specific functions
$functions_path = get_template_directory() . ‘/functions/’;
$includes_path = get_template_directory() . ‘/includes/’;

// Define the theme-specific key to be sent to PressTrends.
define( ‘yrus_PRESSTRENDS_THEMEKEY’, ‘lt384huxazx27rvdk1mmm5byw4h73jrol’ );

// yrusFramework
require_once ($functions_path . ‘admin-init.php’ ); // Framework Init

/*———————————————————————————–*/
/* Load the theme-specific files, with support for overriding via a child theme.
/*———————————————————————————–*/

$includes = array(
‘includes/theme-options.php’, // Options panel settings and custom settings
‘includes/theme-functions.php’, // Custom theme functions
‘includes/theme-plugins.php’, // Theme specific plugins integrated in a theme
‘includes/theme-actions.php’, // Theme actions & user defined hooks
‘includes/theme-comments.php’, // Custom comments/pingback loop
‘includes/theme-js.php’, // Load JavaScript via wp_enqueue_script
‘includes/sidebar-init.php’, // Initialize widgetized areas
‘includes/theme-widgets.php’ // Theme widgets
);

// Allow child themes/plugins to add widgets to be loaded.
$includes = apply_filters( ‘yrus_includes’, $includes );

foreach ( $includes as $i ) {
locate_template( $i, true );
} ?>

{/code}

2. Still not done ?, Go to the file and to the specified line number (this you can find in the error itself) clear the empty space or line break which may be present in the file.

3. You may also want to visit this link  http://wordpress.org/support/topic/that-darn-message-again-warning-cannot-modify-header-information

Hope this helps.