• I am receiving the following error when attempting to upload images. I also cannot remove a couple plug ins I installed. I think this has something to do with it all. Any assistance would be appreciated.

    Warning: Cannot modify header information - headers already sent by (output started at /home/wp-content/themes/notepad/functions.php:38) in /wp-admin/async-upload.php on line 35 1102

Viewing 13 replies - 1 through 13 (of 13 total)
  • You modified something in your functions.php file that is causing it to get an error.

    Thread Starter cofee_iv

    (@cofee_iv)

    Correct.

    Here is my function.php code. Any idea what is wrong?

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebars(2, array(
            'before_widget' => '<div id="%1$s" class="w-block dbx-box %2$s">',
            'after_widget' => '</div></div>',
            'before_title' => '<h2>',
            'after_title' => '</h2><div class="widget-entry">',
        ));
    ?><?php wp_footer(); ?>
    <?php function widget_search() {
    ?><?php
    }
    if ( function_exists('register_sidebar_widget') )
        register_sidebar_widget(__('Search'), 'widget_search');
    ?>
    <script type="text/javascript">
    (function() {
        window.PinIt = window.PinIt || { loaded:false };
        if (window.PinIt.loaded) return;
        window.PinIt.loaded = true;
        function async_load(){
            var s = document.createElement("script");
            s.type = "text/javascript";
            s.async = true;
            s.src = "http://assets.pinterest.com/js/pinit.js";
            var x = document.getElementsByTagName("script")[0];
            x.parentNode.insertBefore(s, x);
        }
        if (window.attachEvent)
            window.attachEvent("onload", async_load);
        else
            window.addEventListener("load", async_load, false);
    })();
    </script>

    It’s possible you left extra space at the end of your file and that’s causing the error.

    Thread Starter cofee_iv

    (@cofee_iv)

    I have checked that. There are no extra spaces at the end.

    oh just found it it’s the quotations you need to escape it with \ if its within php code

    so its going to look something like

    <div id=\”%1$s\” class=\”w-block dbx-box %2$s\”>’,

    <div class=\”widget-entry\”>

    also I’m not quite sure, but I don’t remember <?php wp_footer(); ?> belonging in functions.php

    I would also change %1$s and %2$s since that might interact weird with php

    Thread Starter cofee_iv

    (@cofee_iv)

    I tried the following, but it didn’t change anything. I didn’t understand the other suggestion you made.

    <div id=\"%1$s\" class=\"w-block dbx-box %2$s\">',
    
    <div class=\"widget-entry\">

    The changes I made earlier today had to do with the lower portion of the script.

    Oh okay. I would change it back up to how it used to be

    <div id="%1$s" class="w-block dbx-box %2$s">
    
    <div class="widget-entry">

    Just to troubleshoot, I would try removing the javascript temporarily and see if it your website works again with the javascript removed.

    If it starts to work, then it is the javascript that’s giving you the problem and you might have to load it in a different file and then just enqueue it in your functions file.

    https://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Thread Starter cofee_iv

    (@cofee_iv)

    That didn’t seem to help.

    Hmmm… make sure you are clearing your browser cache when testing whether the website works.

    Also I’m assuming you are using your FTP to edit your functions.php to make sure the changes you create are actually saved.

    Other than that, it’s beyond me :/ Maybe someone more well-versed can weigh in as to what’s causing the error. Though seeing as to this doesn’t seem to be the under a child themes functions.php being in /notepad/functions.php not /notepad-childthem/functions.php I’m assuming you changed the main themes functions.php so you might have changed something else in there that’s causing the error.

    Thread Starter cofee_iv

    (@cofee_iv)

    Aha! I discovered the problem in the footer.php. Solved! Thank you so much for your time and energies.

    Wait it wasnt the functions.php at all?

    I want to learn a bit more about wordpress so do you mind telling me what it was that made it work?

    Thread Starter cofee_iv

    (@cofee_iv)

    I was surprised, also. I thought I had totally forgotten I edited the footer. It was the first thing you thought of, which was an extra space. I simply removed the space. Whew! That was a mystery!

    I am now able to reinstall the plug in I wanted. I discovered it worked without going in and messing in the files, so I don’t know why those instructions were included in the tutorial I read.

    Oh i see. But it said on the error function.php hmm i dont get it still lol. Well im glad u sorted it out. Thanks for telling me 🙂 GLHF!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘functions error?’ is closed to new replies.