treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] chriscoyer blank template uploading

  • Wordpress: Why when I'm using chris coyer blank template it's working fine on localhost and after I'm trying to upload it i can't login to the admin, i'm getting error:

    Warning: Cannot modify header information - headers already sent by (output started at .../functions.php:10) in .../wp-includes/pluggable.php on line 881 ?

    (and when I'm deleteing functions.php i can login to the admin)

  • Well, what's on line 881?

  • header("Location: $location", true, $status);

    it's probably calling the header twice... i never could upload chriscoyer blank template without this error

  • Warning: Cannot modify header information - headers already sent...

    This means that output (HTML, another HTTP header, even just whitespace) has already been sent to the client, so it's too late to send another header (the Location header, in this case).

    I'm a little confused by your second post. Are you getting this error when you're trying to upload the file? If so, how exactly are you trying to upload it?

    ...or, are you getting this error after you upload the file - when you're trying to use it?

    In any case, you can fix the error by moving all output after the header call, or vice-versa. (This may or may not be easier said than done.) If you need more help, you're going to have to provide the relevant code.

  • i'm not uploading the file, i'm uploading the all wordpress folder btw - this is the website: http://pierangelochifari.com/ let me explain the steps i did:

    1. i did download the chriscoyer blank template
    2. i've built the website and styled it (so far it's working fine on the localhost)
    3. i did upload all the wordpress folder and import all the database to the online
    4. now as you can see.. try to login to the wp-admin you'll get this error

    now when i'm deleteing the functions.php i can login to the wp-admin so i'm not sure why is that hapenning, now i don't have a special code in the functions.php, i just enabled the 'featured image' and the 'custom menu' in the function, that's all

    please help if you know the answer

  • Did you update the database to match the new URL's?

  • yes, i opened the sql file, and replaced all to the new URL (to the domain)

  • @realife Do you have Wordpress in a subfolder?

  • no, it's in the root of the domain directory

  • @realife Okay, do you have any plugins? Also, please post your index.php file

  • none, didn't install nothing, just worked on my design index.php, header.php, page.php, single.php, footer.php, archive.php, 404.php, style.css

  • @realife Post your index.php file that is in your root, not from your theme.

  • <?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */

    /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */

    define('WP_USE_THEMES', true);

    /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php');

  • @realife Try removing the period and forward slash before `wp-blog-header.php

    So basically this:

      /** Loads the WordPress Environment and Template */ 
      require('wp-blog-header.php');
    
  • ok... still having that error when trying to login to the wp-admin

  • how do you explain that if I'm just renaming or removing the functions.php it's working... :/

  • @realife I'm starting to think this might have something to do with your permalinks. Have you changed them at any point from the time you were editing it locally to when you uploaded the files to a live server?

    Post your functions.php file

  • I was able to access your login page for a second and then I tried 30 seconds later after testing your other pages and now there's an error. So whatever you did, it solved it.

  • oh the permalinks.. i remember that when sometimes you need to change it, and then turn in back.. just to make some refresh of something.. i think now it's working, can you check now and tell me if you can get the wp-admin page?

  • well you know what i did.. i renamed the functions.php so i can login to the wp-admin and play with the permalinks but then i turned it back.. so i guess it's still not working... :/

  • @realife Can you post your entire functions.php file?

  • Sure, thanks for the big support

    <?php /* Footer Widgets --------------------------------------------------------------------------- */ if ( function_exists('register_sidebar') ) { register_sidebar(); register_sidebars(3, array('name'=>'Footer %d')); } /* Add Feature Images Support --------------------------------------------------------------------------- */ add_theme_support( 'post-thumbnails' ); /* Add Feature Menus Support --------------------------------------------------------------------------- */ add_theme_support( 'menus' ); ?>

  • @realife That's it? What is on line 76?

  • is it working for you now?

  • @realife Yes. All pages including the login work.

  • i think it was the space at the end of the functions...

  • @realife Haha. That actually does cause an issue. I should have thought of that. I'm glad you've got this solved.

  • @chrisburton Thanks so much This is the second time that you helping me =) may i ask if you do have linkedin?

  • @realife I do not. I'm lucky I never signed up. I hear you get a lot of unwanted emails from them.

  • Ok .. i don't wanna push, anyway nice meeting ya

  • Likewise.