Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS WordPress error: call to undefined function get_header()

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #32619
    cmegown
    Member

    Howdy folks, firstly I’d like to thank Chris and Jeff for writing such an amazing book! I’m very new to WordPress and the book was perfect for getting me started the right way :) That being said…

    I’ve taken a little bit from the book, a little bit from the ‘twentyten’ theme, and a little bit from a few other themes, all to try to make my first theme (which is very, very basic). Now, I’ve got my file structure just like the book says (security through obscurity), and while testing my theme I’m getting the following error:

    Fatal Error: Call to undefined function get_header() in …

    I’m in serious need of help here folks, I’m not new to programming, but I’m a big WP noob for now.

    Secondly, and this is something that is truly confusing me…I’m unable to get any content (posts, pages, etc) in my new theme even though about 90% of the code is the exact same as the code in ‘twentyten’. Any idea why my loops might not be working?

    #46920
    TheDoc
    Member

    Many times this error comes up due to a plugin that has been installed. Deactivate all of your plugins to see if it is fixed. If the error goes away, re-activate them one by one until you find the culprit.

    The 2010 Theme has its Loops set up quite differently to how I do it, so I can’t quite comment on it. If you post the code that you have for page.php and single.php I’m sure I can get a better idea.

    #46916
    cmegown
    Member

    Thank you so much for you quick and kind response!

    page.php


    
    get_header();
    ?>









    get_sidebar();
    get_footer();
    ?>

    single.php


    
    get_header();
    ?>









    get_sidebar();
    get_footer();
    ?>

    I’m on a local install, so I’d be surprised if it was a plugin, but I’ll check while you review this code :P

    #46900
    cmegown
    Member

    Wow, that really butchered my code, those br tags shouldn’t be there!

    (Edit: Fixed by TheDoc)

    #46884
    cmegown
    Member

    Btw, my local install has 0 ZERO zip NADDA plugins installed

    #46872
    ccc630
    Member

    It could be a problem with the file type — I’ve experienced this same problem working in Coda if I just click the ‘new file’ icon instead of creating a new html-php file through ‘File -> New’. I don’t have enough knowledge to explain *why* that’s the case, though. Hopefully someone else can?

    #46873
    TheDoc
    Member

    On either page.php or single.php, replace your call to the Loop with this:







    That will make sure at least that things are working as they should.

    #46865
    cmegown
    Member

    Thank you for your help guys, the problem has been solved :) Doc, you are right in your method, but I backtracked and discovered that my loop.php had a large number of syntax errors. So once I fixed those, the problem cleared right up!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.