WordPress.org

Ready to get started?Download WordPress

Forums

Functions php Error (2 posts)

  1. Oktorian
    Member
    Posted 1 year ago #

    Hi Guys,

    Have particular problem here. I am using bloggie theme and trying to make some edit on single php and functions php. (I just follow some guide through search engine).

    But then I cancelled all the edit. That's where the problem started.

    Now I can't make update post or even log out. There's always warning pop-up.

    Here's the warning when I hit update post:

    Warning: Cannot modify header information - headers already sent by (output started at /home/oktorian/public_html/wp-content/themes/bloggie/functions.php:282) in /home/oktorian/public_html/wp-includes/pluggable.php on line 876

    And here's the warning when I try to log out:

    the url turn to : http://notordinaryblogger.com/wp-login.php?action=logout&_wpnonce=bab55210a4

    Warning: Cannot modify header information - headers already sent by (output started at /home/oktorian/public_html/wp-content/themes/bloggie/functions.php:282) in /home/oktorian/public_html/wp-login.php on line 368

    What can I possibly do?

    Here is my single post php code :

    Original script

    <?php $options = get_option('bloggie'); ?>
    <?php get_header(); ?>
    <div id="page" class="single">
    	<div class="content">
    		<article class="article">
    			<div id="content_box" >
    				<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    					<div id="post-<?php the_ID(); ?>" <?php post_class('g post'); ?>>
                        <div class="single_post">
    
    						<header>
    
    						<h1 class="title single-title"><?php the_title(); ?></h1>
                            <span class="theauthor single-postmeta">Posted in <?php $category = get_the_category(); echo '<a>cat_ID).'">'.$category[0]->cat_name.'</a>';?> by <?php the_author_posts_link(); ?></span>
    						</header><!--.headline_area-->
    
    						<div class="post-single-content box mark-links">
    						<?php if ($options['mts_posttop_adcode'] != '') { ?>
    							<div class="topad">
    								<?php echo $options['mts_posttop_adcode']; ?>
    							</div>
    						<?php } ?>
    							<?php the_content(); ?>
    							<?php wp_link_pages('before=<div class="pagination2">&after=</div>'); ?>
    						<?php if ($options['mts_postend_adcode'] != '') { ?>
    							<div class="bottomad">
    								<?php echo $options['mts_postend_adcode'];?>
    							</div>
    						<?php } ?>
    						<?php if($options['mts_tags'] == '1') { ?>
    							<div class="tags"><?php the_tags('<span class="tagtext">Tags:</span>',',') ?></div>
    						<?php } ?>
    							</div>
    						</div><!--.post-content box mark-links-->
    						<?php if($options['mts_related_posts'] == '1') { ?>
    								<?php
    								$categories = get_the_category($post->ID);
    								if ($categories) {
    								$category_ids = array();
    								foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
    
    								$args=array(
    								'category__in' => $category_ids,
    								'post__not_in' => array($post->ID),
    								'showposts'=>2, // Number of related posts that will be shown.
    								'orderby'=> rand,
    								'caller_get_posts'=>1
    								);
    
    								$my_query = new wp_query( $args );
    								if( $my_query->have_posts() ) {
    								echo '<div class="related-posts"><div class="postauthor-top"><h3>'.__('Related Posts','mythemeshop').'</h3></div>
    <ul>';
    								while( $my_query->have_posts() ) {
    								++$counter;
    								if($counter == 2) {
    								$postclass = 'last';
    								$counter = 0;
    								} else { $postclass = ''; }
    								$my_query->the_post();?>
    
    								<li class="<?php echo $postclass; ?>">
    									<a rel="nofollow">" rel="bookmark" title="<?php the_title(); ?>">
    								<span class="rthumb">
    									<?php if(has_post_thumbnail()): ?>
    										<?php echo the_post_thumbnail('featured-small', 'title='); ?>
    									<?php else: ?>
    										<img src="<?php echo get_template_directory_uri(); ?>/images/relthumb.png" alt="<?php the_title(); ?>"  width='82' height='60' class="wp-post-image" />
    									<?php endif; ?>
    								</span>
                                        <span><?php the_title(); ?></span>
    									</a>
    
    								<?php
    								}
    								echo '</ul>
    </div>';
    								}
    								}
    								wp_reset_query();
    								?>
    							<!-- .related-posts -->
                            <?php }?>
    						<?php if($options['mts_author_box'] == '1') { ?>
    						<div class="postauthor">
                            <h4><?php _e('About Author', 'mythemeshop'); ?></h4>
    							<?php if(function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), '75' );  } ?>
    							<p><?php the_author_meta('description') ?></p>
    						</div>
    						<?php }?>
    					</div><!--.g post-->
    					<?php comments_template( '', true ); ?>
    				<?php endwhile; /* end loop */ ?>
    			</div>
    </article>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    
    And here's my functions php :
    
    <?php
    
    require_once( dirname( __FILE__ ) . '/theme-options.php' );
    
    if ( ! isset( $content_width ) ) $content_width = 960;
    
    /*-----------------------------------------------------------------------------------*/
    /*	Load Translation Text Domain
    /*-----------------------------------------------------------------------------------*/
    
    load_theme_textdomain( 'mythemeshop', TEMPLATEPATH.'/lang' );
    
    if ( function_exists('add_theme_support') ) add_theme_support('automatic-feed-links');
    
    /*-----------------------------------------------------------------------------------*/
    /*	Post Thumbnail Support
    /*-----------------------------------------------------------------------------------*/
    	if ( function_exists( 'add_theme_support' ) ) {
    	add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 200, 200, true );
    	add_image_size( 'featured', 200, 147, true ); //featured
    	add_image_size( 'featured-small', 82, 60, true ); //sidebar
    	}
    
    /*-----------------------------------------------------------------------------------*/
    /*	Enable Widgetized sidebar
    /*-----------------------------------------------------------------------------------*/
    	if ( function_exists('register_sidebar') )
    	// Header Widget
    	register_sidebar(array('name'=>'Header',
    		'description' => __('This header area can be used for Search Form or 728x90 Ad.', 'mythemeshop'),
    		'before_widget' => '<div class="widget-area widget-header">
    <ul>',
    		'after_widget' => '</ul>
    </div>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>',
    	));
    	// Sidebar Widget
    	register_sidebar(array('name'=>'Sidebar',
    		'before_widget' => '<li class="widget widget-sidebar">',
    		'after_widget' => '',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    /*-----------------------------------------------------------------------------------*/
    /*	Load Widgets & Shortcodes
    /*-----------------------------------------------------------------------------------*/
    
    // Add the 125x125 Ad Block Custom Widget
    include("functions/widget-ad125.php");
    
    // Add the 125x125 Ad Block Custom Widget
    include("functions/widget-ad300.php");
    
    // Add the 125x125 Ad Block Custom Widget
    include("functions/widget-tabs.php");
    
    // Add Facebook Like box Widget
    include("functions/widget-fblikebox.php");
    
    // Add Subscribe Widget
    include("functions/widget-subscribe.php");
    
    // Add Welcome message
    include("functions/welcome-message.php");
    
    /*-----------------------------------------------------------------------------------*/
    /*	Filters customize wp_title
    /*-----------------------------------------------------------------------------------*/
    // Filter the page title wp_title() in header.php
    	if ( ! function_exists('mythemeshop_page_title' ) ) {
    		function mythemeshop_page_title( $title ) {
    			$the_page_title = $title;
    			if( ! $the_page_title ){
    				$the_page_title = get_bloginfo("name");
    			}else{
    				$the_page_title = $the_page_title;
    			}
    			return $the_page_title;
    		}
    		add_filter('wp_title', 'mythemeshop_page_title');
    	}
    /*-----------------------------------------------------------------------------------*/
    /*	Filters that allow shortcodes in Text Widgets
    /*-----------------------------------------------------------------------------------*/
    
    add_filter('widget_text', 'shortcode_unautop');
    add_filter('widget_text', 'do_shortcode');
    
    /*-----------------------------------------------------------------------------------*/
    /*	Search form in first navigation
    /*-----------------------------------------------------------------------------------*/
    //add_filter('wp_nav_menu_items', 'add_search_form', 10, 2);
    function add_search_form($items, $args) {
    if( $args->theme_location == 'primary-menu' )
            $items .= get_search_form( $echo );
            return $items;
    }
    
    /*-----------------------------------------------------------------------------------*/
    /*	Register Footer widgets
    /*-----------------------------------------------------------------------------------*/
    if (function_exists('register_sidebar')) {
    	$sidebars = array(1, 2, 3);
    	foreach($sidebars as $number) {
    	register_sidebar(array(
    		'name' => 'Footer ' . $number,
    		'id' => 'footer-' . $number,
    		'before_widget' => '<div class="widget">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>'
    	));
    	}
    }
    function widgetized_footer() {
    ?>
    		<div class="f-widget">
    			<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 1') ) : ?>
    			<?php endif; ?>
    		</div>
            <div class="sepFoot"></div>
    		<div class="f-widget">
    			<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 2') ) : ?>
    			<?php endif; ?>
    		</div>
            <div class="sepFoot"></div>
    		<div class="f-widget last">
    			<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 3') ) : ?>
    			<?php endif; ?>
    		</div>
    <?php
    }
    
    /*-----------------------------------------------------------------------------------*/
    /*	Custom Comments template
    /*-----------------------------------------------------------------------------------*/
    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>" style="position:relative;">
         <div class="commentImageLeft"></div>
          <div class="comment-author vcard">
             <?php echo get_avatar( $comment->comment_author_email, 75 ); ?>
    
             <?php printf(__('<span class="fn">%s</span>'), get_comment_author_link()) ?> 
    
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?php _e('Your comment is awaiting moderation.') ?></em>
    
          <?php endif; ?>
    
          <div class="comment-meta commentmetadata">
    
    	  <?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
    
          <?php comment_text() ?>
    
          <div class="reply">
             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php
            }
    /*-----------------------------------------------------------------------------------*/
    /*	Custom Menu Support
    /*-----------------------------------------------------------------------------------*/
    	add_theme_support( 'menus' );
    	if ( function_exists( 'register_nav_menus' ) ) {
    	  	register_nav_menus(
    	  		array(
    	  		  'primary-menu' => 'Primary Menu',
    			  'secondary-menu' => 'Secondary Menu',
    	  		)
    	  	);
    	}
    
    /*-----------------------------------------------------------------------------------*/
    /*	excerpt
    /*-----------------------------------------------------------------------------------*/
    
    // Excerpt length
    function excerpt($limit) {
      $excerpt = explode(' ', get_the_excerpt(), $limit);
      if (count($excerpt)>=$limit) {
        array_pop($excerpt);
        $excerpt = implode(" ",$excerpt);
      } else {
        $excerpt = implode(" ",$excerpt);
      }
      $excerpt = preg_replace('<code>[[^]]*]</code>','',$excerpt);
      return $excerpt;
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* nofollow to next/previous links
    /*-----------------------------------------------------------------------------------*/
    function pagination_add_nofollow($content) {
        return 'rel="nofollow"';
    }
    add_filter('next_posts_link_attributes', 'pagination_add_nofollow' );
    add_filter('previous_posts_link_attributes', 'pagination_add_nofollow' );
    
    /*-----------------------------------------------------------------------------------*/
    /* Nofollow to category links
    /*-----------------------------------------------------------------------------------*/
    add_filter( 'the_category', 'add_nofollow_cat' );
    function add_nofollow_cat( $text ) {
    $text = str_replace('rel="category tag"', 'rel="nofollow"', $text); return $text;
    }
    /*-----------------------------------------------------------------------------------*/
    /* removes detailed login error information for security
    /*-----------------------------------------------------------------------------------*/
    	add_filter('login_errors',create_function('$a', "return null;"));
    
    /*-----------------------------------------------------------------------------------*/
    /* removes the WordPress version from your header for security
    /*-----------------------------------------------------------------------------------*/
    	function wb_remove_version() {
    		return '<!--Theme by MyThemeShop.com-->';
    	}
    	add_filter('the_generator', 'wb_remove_version');
    
    /*-----------------------------------------------------------------------------------*/
    /* Removes Trackbacks from the comment count
    /*-----------------------------------------------------------------------------------*/
    	add_filter('get_comments_number', 'comment_count', 0);
    	function comment_count( $count ) {
    		if ( ! is_admin() ) {
    			global $id;
    			$comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
    			return count($comments_by_type['comment']);
    		} else {
    			return $count;
    		}
    	}
    
    /*-----------------------------------------------------------------------------------*/
    /* category id in body and post class
    /*-----------------------------------------------------------------------------------*/
    	function category_id_class($classes) {
    		global $post;
    		foreach((get_the_category($post->ID)) as $category)
    			$classes [] = 'cat-' . $category->cat_ID . '-id';
    			return $classes;
    	}
    	add_filter('post_class', 'category_id_class');
    	add_filter('body_class', 'category_id_class');
    
    /*-----------------------------------------------------------------------------------*/
    /* adds a class to the post if there is a thumbnail
    /*-----------------------------------------------------------------------------------*/
    	function has_thumb_class($classes) {
    		global $post;
    		if( has_post_thumbnail($post->ID) ) { $classes[] = 'has_thumb'; }
    			return $classes;
    	}
    	add_filter('post_class', 'has_thumb_class');
    
    /*-----------------------------------------------------------------------------------*/
    /* Pagination
    /*-----------------------------------------------------------------------------------*/
    function pagination($pages = '', $range = 3)
    { $showitems = ($range * 3)+1;
     global $paged; if(empty($paged)) $paged = 1;
     if($pages == '') {
     global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages)
     { $pages = 1; } }
     if(1 != $pages)
     { echo "<div class='pagination'>
    <ul>";
     if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "
    <li><a rel='nofollow' href='".get_pagenum_link(1)."'>« First</a></li>
    ";
     if($paged > 1 && $showitems < $pages) echo "
    <li><a rel='nofollow' href='".get_pagenum_link($paged - 1)."'>‹ Previous</a></li>
    ";
     for ($i=1; $i <= $pages; $i++)
     { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
     { echo ($paged == $i)? "<li class='current'><span class='currenttext'>".$i."</span>":"
    <li><a rel='nofollow' href='".get_pagenum_link($i)."'>".$i."</a></li>
    ";
     } } if ($paged < $pages && $showitems < $pages) echo "
    <li><a rel='nofollow' href='".get_pagenum_link($paged + 1)."'>Next ›</a></li>
    ";
     if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a rel='nofollow' href='".get_pagenum_link($pages)."'>Last »</a>";
     echo "</ul>
    </div>"; }}
    
    ?>

    Once again, I am not a tech savvy blogger, I do really need help for this issue

    Thanks a lot for your kind attention

  2. Generically speaking: restore a fresh copy of that theme from the place you obtained it from.

    More specifically: That's not a theme we support here, please visit the place where you obtained it.

    http://mythemeshop.com/support/
    http://community.mythemeshop.com/

Topic Closed

This topic has been closed to new replies.

About this Topic