0

I just started getting this error on my wordpress site when I try and access certain pages. I have checked the3 /custom_functions.php file and I see nothing that looks out of place. Any help would be appreciated. The site is whowillwinthe2012election.com

Warning: Cannot modify header information - headers already sent by (output started at /home/cdunde1/public_html/wp-content/themes/thesis-15/custom/custom_functions.php:1) in /home/cdunde1/public_html/wp-includes/pluggable.php on line 890

Here is the code from the custom_functions.php file

<?php

// Using hooks is absolutey the smartest, most bulletproof way to implement things like plugins,
// custom design elements, and ads. You can add your hook calls below, and they should take the 
// following form:
// add_action('thesis_hook_name', 'function_name');
// The function you name above will run at the location of the specified hook. The example
// hook below demonstrates how you can insert Thesis' default recent posts widget above
// the content in Sidebar 1:
// add_action('thesis_hook_before_sidebar_1', 'thesis_widget_recent_posts');


/**
 * function custom_bookmark_links() - outputs an HTML list of bookmarking links
 * NOTE: This only works when called from inside the WordPress loop!
 * SECOND NOTE: This is really just a sample function to show you how to use custom functions!
 *
 * @since 1.0
 * @global object $post
*/

function custom_bookmark_links() {
	global $post;
?>
<ul class="bookmark_links">
	<li><a rel="nofollow" href="http://delicious.com/save?url=<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>" onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>', 'delicious', 'toolbar=no,width=550,height=550'); return false;" title="Bookmark this post on del.icio.us">Bookmark this article on Delicious</a></li>
</ul>
<?php
}



remove_action('thesis_hook_before_header', 'thesis_nav_menu'); add_action('thesis_hook_after_header', 'thesis_nav_menu');


/* Add the top navigation menu */
/* Links for top menu will need to be manually added here, since this menu isn't supported by Thesis */
function topnav_menu() {
?>
<ul id="topnav">
<li><a href="http://www.whowillwinthe2012election.com/?page_id=469">2012 Election</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=435">Barack Obama</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=461">Sarah Palin</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=471">Hillary Clinton</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=566">Mitt Romney</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=592">Michael Steele</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=615">Bobby Jindal</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=644">Mike Huckabee</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=646">Newt Gingrich</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=851">Tim Pawlenty</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=902">Jeb Bush</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=911">Charlie Crist</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=996">Condoleezza Rice</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1014">Fred Thompson</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1212">Bill O'Reilly</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1218">Ron Paul</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1214">Rush Limbaugh</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1223">Glenn Beck</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1229">Sean Hannity</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1733">Michele Bachmann</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1852">Lou Dobbs</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1909">Rick Santorum</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=1912">Rudy Giuliani</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=2318">Joseph Lieberman</a></li>
<li><a href="http://www.whowillwinthe2012election.com/?page_id=2481">John Thune</a></li>
</ul>
<?php
}
add_action('thesis_hook_before_header', 'topnav_menu');


function post_footer_author() {
if (is_single())
{ ?>
<div class="postauthor">
<?php echo get_avatar( get_the_author_id() , 100 ); ?>
<h4>Article by <a href="<?php the_author_url(); ?>">
<?php the_author_firstname(); ?> <?php the_author_lastname(); ?></a></h4>
<p><?php the_author_description(); ?></p>
<p class="hlight"><?php the_author_firstname(); ?> has written <span><?php the_author_posts(); ?></span> awesome articles.</p>
<p>Subscribe to Who Will Win The 2012 Election feed via <a href="http://feeds2.feedburner.com/2012presidentialelection"><b>RSS</b></a></p>
</div>
<?php }
}
add_action('thesis_hook_after_post_box', 'post_footer_author');

function thesis_promo() {
if (is_single()) {
echo '
<div class="promobox2">
<h3 align="center">Tweet your thoughts on this article</h3>
<P align=center><div id="tbox"></div></A>

</P>
</div>
<br />
';
}
}
add_action('thesis_hook_after_post', 'thesis_promo');


add_action('thesis_hook_before_header', 'sitewide_left_feedback_buttons');

function sitewide_left_feedback_buttons() { ?>
   <div id="feedback">
      <a href="http://twitter.com/2012President" id="twitter" target="_blank" title="Follow Us on Twitter">Follow Us on Twitter</a>
      <a href="http://feeds.feedburner.com/2012PresidentialElection" id="rss" target="_blank" title="Subscribe to Who Will Win The 2012 Election via RSS">Subscribe to Who Will Win The 2012 Election  via RSS</a>
      <a href="mailto:electionsupervisor@whowillwinthe2012election.com" id="email" title="Contact Us">Contact Us</a>
      <a href="http://www.facebook.com/editapps.php?ref=mb#/group.php?gid=280129830495&ref=ts" id="facebook" title="Visit us on Facebook" target="_blank">Visit us on Facebook</a>
      
   </div>
<?php }

/* Custom Categories */
function custom_archive_info() {
if (is_category('barack-obama')) {
?>
<div class="post_box top intro_block">
<div class="headline_area">
<h1><?php single_cat_title(); ?></h1>
</div>
<div class="format_text">
<p><center><IMG border=0 hspace=0 alt="Prersident Barack Obama" 
src="http://www.whowillwinthe2012election.com/images/obama_ad.jpg" width=200 
height=200></p>
</div>
</div>
<?php
}
elseif (is_category('2012-election')) {
?>
<div class="post_box top intro_block">
<div class="headline_area">
<h1><?php single_cat_title(); ?></h1>
</div>
<div class="format_text">
<p>Is there a republican candidate who can defeat President Obama in 2012</p>
</div>
</div>
<?php
}
else
thesis_default_archive_info();
}
remove_action('thesis_hook_archive_info', 'thesis_default_archive_info');
add_action('thesis_hook_archive_info', 'custom_archive_info'); 

function post_article_call() {
if (is_single( )) { ?>

<div class="post_ad">
	<h3>We appreciate you visiting our site </h3>
	</A><P>We hope you have enjoyed the great articles on this site that are written by people like you who are passionate about their country &amp; their political beliefs.&nbsp; This site was founded to give the average&nbsp;person a forum to express their political views &amp; so that we could give honest &amp; factual information on political candidates. This site is non-partisan as we belief in healthy debate between those of all poliitcal affiliations.&nbsp; The 2010 midterm elections are fast approaching &amp; we want the best people possible to be elected.&nbsp;See our 2010 midterm&nbsp;candidate&nbsp;page <A href="http://www.whowillwinthe2012election.com/2010-senate-elections/">here</A>. Interested in expressing yourself on our site? Register as a political blogger <A href="http://www.whowillwinthe2012election.com/machform/view.php?id=2">here</A>. If you currently have your own political blog&nbsp;you can guest blog on our site by contacting us <A href="http://www.whowillwinthe2012election.com/machform/view.php?id=3">here</A>.&nbsp; Subscribe to&nbsp;our feed&nbsp;<A href="http://feeds.feedburner.com/2012presidentialelection">via RSS</A> or <A href="http://feedburner.google.com/fb/a/mailverify?uri=2012PresidentialElection&amp;amp;loc=en_US">via e-mail</A>.&nbsp;Follow&nbsp;us on <A href="http://twitter.com/2012president">Twitter</A>&nbsp;&amp; join us on <A href="http://www.facebook.com/group.php?gid=280129830495&amp;ref=ts">Facebook</A>.

</P></P>  
</div>
<?php }}
add_action('thesis_hook_after_post', 'post_article_call');

/*---------------------------------*/
/* WIDGETIZED FOOTER - 4 COLUMNS   */
/* Mike Nichols - October 17, 2009 */
/*---------------------------------*/

/*-----------------------------------------*/
/* register sidebars for widgetized footer */
if (function_exists('register_sidebar')) {
	$sidebars = array(1, 2, 3, 4);
	foreach($sidebars as $number) {
		register_sidebar(array(
			'name' => 'Footer ' . $number,
			'id' => 'footer-' . $number,
			'before_widget' => '',
			'after_widget' => '',
			'before_title' => '<h3>',
			'after_title' => '</h3>'
		));
	}
}

/*-----------------------*/
/* set up footer widgets */
function widgetized_footer() {
?>
	<div id="footer_setup">

		<div class="footer_items">
  	  		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 1') ) : ?>
    		<?php endif; ?>
		</div>

		<div class="footer_items">
    		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 2') ) : ?>
    		<?php endif; ?>
		</div>

		<div class="footer_items">
    		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 3') ) : ?>
    		<?php endif; ?>
		</div>

		<div class="footer_items">
    		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 4') ) : ?>
    		<?php endif; ?>
		</div>
		
	</div>
<?php
}
add_action('thesis_hook_footer','widgetized_footer');



//featured content
function featcc() {
if (is_home()){
global $post;
if( function_exists( 'dynamic_content_gallery' ) ) :
dynamic_content_gallery();
endif;
}
}

add_action('thesis_hook_feature_box', 'featcc');


/* My Custom Widget */

add_action('widgets_init', 'my_text_widget_init');

function my_text_widget_init() {
register_sidebar_widget('My Custom Widget', 'my_text_widget');
}

function my_text_widget() { ?>
<li class="widget">
<div class="my_widget_header">
<h3><span style="color: #ff0000;">2012 Election Poll Leader</span></h3>
</div>
<div id="widget_content">
<img class="widget_icon" src="http://www.whowillwinthe2012election.com/images/ron.jpg" height="100px" alt="" />
<span style="color: #ff0000;">Ron Paul is the current leader in our 2012 election poll.  Barack Obama led in the beginning but now Paul is the leader with Mitt Romney in 2nd place.<br>
<center><A href="http://www.whowillwinthe2012election.com/2012electionpoll.php">Vote Now</A>  </span>
</div>
</li>
<?php
}

//Twitter @Anywhere
function twitter_anywhere_html() {
?>
<script src="http://platform.twitter.com/anywhere.js?id=qdwZT5fRAfYILsrR8yeCyA&v=1"></script>
  <script type="text/javascript">
    twttr.anywhere(function(twitter) {
              twitter.hovercards();
              twitter('#follow-2012president').followButton("2012president");
 });
   twttr.anywhere(function (T) {
              T("#tbox").tweetBox({
              height: 100,
              width: 400,
              defaultContent: "@2012president"
              });
 });
  </script>
<?php }
add_action('thesis_hook_after_html','twitter_anywhere_html');
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by cdunde1
0

I'm no Wordpress expert, but I'll give it a shot. My guess is that your functions are being called before Wordpress outputs a header (such as a redirect). This will cause problems because headers are sent after the first character of content has been outputted. It might help to actually echo the values instead of end the PHP and insert them in the file. Try something like this:

<?php
function test() {
    global $whatever;
    echo '<b>some html here</b><em>and lets add that global: '.$whatever.'</em>';
}
?>

Instead of:

<?php
function test() {
    global $whatever;
?>
<b>some html here</b><em>and lets add that global: <?= $whatever ?></em>
<?php
}
?>

Edited by FlashCreations: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.