• I’ve read so many threads on this topic, I know it’s an oldy but a goody…

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/65/4784765/html/wp-content/themes/wapp/functions.php:1) in /home/content/65/4784765/html/wp-includes/pluggable.php on line 866

    I’ve checked for spaces in header.php, wp-config.php, functions.php, and pluggable.php…no spaces at the beginning or end…of the file.

    I’ve tried deleting the lines in functions.php…makes no difference…

    Help. https://www.viewmarkcommunications.com

    My functions.php file:

    <?php
    // initialization
    include_once TEMPLATEPATH . '/functions/init.php';
    // utilities
    include_once TEMPLATEPATH . '/functions/utilities.php';
    // short codes
    include_once TEMPLATEPATH . '/functions/short_codes.php';
    // Advanced excerpt
    include_once TEMPLATEPATH . '/functions/excerpt.php';
    // view helpers
    include_once TEMPLATEPATH . '/functions/views.php';
    // comment functions
    include_once TEMPLATEPATH . '/functions/comments.php';
    // pagination
    include_once TEMPLATEPATH . '/functions/pagination.php';
    // widgets
    include_once TEMPLATEPATH . '/functions/widgets.php';
    // monkpanel
    include_once TEMPLATEPATH . '/functions/monkpanel/functions.php';
    
    function load_js_libraries() {
      wp_enqueue_script('jquery');
      wp_enqueue_script('libraries', get_template_directory_uri() . '/js/libraries.js', array('jquery'));
      wp_enqueue_script('wMain', get_template_directory_uri() . '/js/main.js', array('jquery'));
    }
    
    // TODO put this in an option
    function get_post_date_format() {
      return 'F jS, Y';
    }
    
    // TODO put this in an option
    function get_comment_date_format() {
      return 'M jS, Y';
    }
    
    function get_header_logo() {
      if (get_option('wapp_logo')) {
        $src = get_option('wapp_logo');
      } else {
        $src = get_template_directory_uri() . '/assets/logo.png';
      }
    
      $alt_title = get_bloginfo('name') . ' - Home';
      return "<img src='$src' alt='$alt_title' title='$alt_title' />";
    }
    
    function get_general_color_scheme() {
      if (get_option('wapp_general_color')) {
        return get_option('wapp_general_color');
      } else {
        return 'teal';
      }
    }
    
    function get_button_color_scheme() {
      if (get_option('wapp_button_color')) {
        return get_option('wapp_button_color');
      } else {
        return 'teal';
      }
    }
    
    function custom_css() {
      $monk_css = '';
    
      if(strlen(get_option('wapp_colors_a')) > 0)
        $monk_css .=  'a { color:' . get_option('wapp_colors_a') . ' }';
      if(strlen(get_option('wapp_colors_a_hover')) > 0)
        $monk_css .= 'a:hover{ color:' . get_option('wapp_colors_a_hover') . ' }';
      if(strlen(get_option('wapp_colors_a_dark')) > 0)
        $monk_css .= '.links_dark a, .link_dark, #header_nav > li > a[href]:hover, #header_nav li.active a.parent[href] { color:' . get_option('wapp_colors_a_dark') . ' }';
      if(strlen(get_option('wapp_colors_a_dark_hover')))
        $monk_css .=  '.links_dark a:hover, .link_dark:hover, #header_nav > li > a[href]:hover, #header_nav li.active a.parent[href]:hover { color:' . get_option('wapp_colors_a_dark_hover') . ' }';
      if(strlen(get_option('wapp_colors_navigation')) > 0)
        $monk_css .=  '#header_nav > li > a { color:' . get_option('wapp_colors_navigation') . ' }';
      if(strlen(get_option('wapp_colors_navigation_hover')) > 0)
        $monk_css .= '#header_nav > li > a:hover { color:' . get_option('wapp_colors_navigation_hover') . ' }';
      if(strlen(get_option('wapp_dropdown_a')) > 0)
        $monk_css .= '#header_nav .children li a { color:' . get_option('wapp_dropdown_a') . ' }';
      if(strlen(get_option('wapp_colors_dropdown_hover')) > 0)
        $monk_css .= '#header_nav .children li a:hover { color:' . get_option('wapp_colors_dropdown_hover') . ' }';
      if(strlen(get_option('wapp_colors_text')) > 0)
        $monk_css .=  'p, ul li, ol li { color:' . get_option('wapp_colors_text') . ' }';
      if(strlen(get_option('wapp_colors_text_alt')) > 0)
        $monk_css .= '#header_top h2, #footer p { color:' . get_option('wapp_colors_text_alt') . ' }';
      if(strlen(get_option('wapp_colors_introduction')) > 0)
        $monk_css .= '#header_intro p { color:' . get_option('wapp_colors_introduction') . ' }';
      if(strlen(get_option('waoo_colors_introduction_bold')) > 0)
        $monk_css .= '#header_intro strong { color:' . get_option('waoo_colors_introduction_bold') . ' }';
      if(strlen(get_option('wapp_colors_text_bold')) > 0)
        $monk_css .= 'strong { color:' . get_option('wapp_colors_text_bold') . ' }';
      if(strlen(get_option('wapp_custom_css')) > 0)
        $monk_css .= get_option('wapp_custom_css');
    
      echo strlen($monk_css) > 0 ? '<style type="text/css">' . addslashes($monk_css) . "</style>" : '';
    }
    
    function custom_js() {
      $js = stripslashes(get_option('wapp_custom_js'));
      echo strlen($js) > 0 ? '<script type="text/javascript">' . $js  . '</script>' : '';
    }
    
    function get_true_comment_count($type = 'comments') {
      if ($type == 'comments'):
        $typeSql = 'comment_type = ""';
      elseif ($type == 'pings'):
        $typeSql = 'comment_type != ""';
      elseif ($type == 'trackbacks'):
        $typeSql = 'comment_type = "trackback"';
      elseif ($type == 'pingbacks'):
        $typeSql = 'comment_type = "pingback"';
      else:
        return;
      endif;
    
      global $wpdb;
      $ID = get_the_ID();
    
      $result = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE $typeSql AND comment_approved='1' AND comment_post_ID = $ID");
      return $result;
    }
    
    function is_true_page($id) {
      global $wpdb;
      $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'page' AND id = $id");
      return $count == 1;
    }
    
    function get_contact_url() {
      global $wpdb;
      $ID = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'template-contact.php' LIMIT 1");
    
      return get_permalink($ID);
    }
    
    function get_products_url() {
      global $wpdb;
      $ID = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value in ('template-allproducts-1.php', 'template-allproducts-2.php', 'template-allproducts-3.php', 'template-allproducts-4.php') LIMIT 1");
    
      return get_permalink($ID);
    }
    
    function get_produtct_url($id) {
      return get_post_meta($id, 'product-url' , true);
    }
    
    function get_products_template() {
      global $wpdb;
      $template_name = $wpdb->get_var("SELECT meta_value, count(*) AS total FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value in ('template-allproducts-1.php', 'template-allproducts-2.php', 'template-allproducts-3.php', 'template-allproducts-4.php') ORDER BY total desc LIMIT 1");
    
      return intval(substr($template_name, 21, 1));
    }
    ?>
Viewing 9 replies - 1 through 9 (of 9 total)
  • You might try re uploading your default functions file,
    If you just want to access your site you could rename your current theme file, if you have another to fall back on.

    Then if all else fails try re uploading the whole wp folder EXCEPT WP-CONTENT of course.

    Thread Starter viewmark

    (@viewmark)

    Thought it was solved…but not so fast….

    Did suggestions 1 & 3…tried renaming my theme file…and when I got into WP…it said it needed to do a database update…

    When the update completed…everything seemed to work…I could access the site…but when I tried to edit a page…I got the same error.

    you say you did 1 and 3, that would be re uploading your default functions.php file, and uploading your whole wp folder except wp-coontent. correct?

    that would not include renaming anything. what ever you renamed, change it back.

    if you did suggestion 2, then my bad, as I meant to say theme folder, not theme file. if this is what you did, what file did you rename? can you revert?

    Thread Starter viewmark

    (@viewmark)

    I renamed the theme folder…which allowed me in as WP defaulted to use the twentyeleven theme. When I use this theme, I can edit pages.

    I uploaded the default functions.php (from the original theme files). I also uploaded wp-admin and wp-includes. But no luck…same problem…same error.

    So when you use the original theme, you get the error when editing ? but otherwise not? What was going on when your original header info error happened?

    Thread Starter viewmark

    (@viewmark)

    Solved…I loaded the original functions.php again…and it now seems to work…thanks…

    nice, I was getting worried I made you rename the wrong thing. really glad you solved.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Warning: Cannot modify header information – functions.php’ is closed to new replies.