• Hi

    The pages of my site (Starkers child theme) are working fine but there are a few files not displaying, namely single.php. 404.php and archive.php. For these, I get the following error:

    Fatal error: Call to undefined function get_header() in /home/fhlinux199/y/mydomain.co.uk/user/htdocs/wp-content/themes/Starkers/single.php on line 10

    And similar for 404.php and archive.php

    Any suggestions as to how I could solve this? I haven’t touched index.php in the root folder or the Starker theme by the way.

    Thanks

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter wambamboo

    (@agatha1)

    To put it another way, where are functions like get_header() and language_attributes() defined? And could I have deleted them accidentally?

    I haven’t touched functions.php in the parent theme.

    Any help at all would be great.

    Thanks

    They are defined in WordPress core.

    Thread Starter wambamboo

    (@agatha1)

    Thanks

    I haven’t touched the WordPress core and the rest of my site is working fine.

    Is there anything I could have done in the theme that could have caused this problem?

    Does the parent theme still work?

    Thread Starter wambamboo

    (@agatha1)

    No, the errors are the same for the parent theme. I’ve reinstalled the parent theme fresh and still the same.

    Have you tried switching to the Twenty Eleven theme?

    Thread Starter wambamboo

    (@agatha1)

    If I switch to TwentyEleven and write the file path directly to single.php, for example, I get a page with only this on it:

    ext/javascript' src='https://www.mydomain.co.uk/wp-content/plugins/contact-form-7/jquery.form.js?ver=2.52'></script>
    <script type='text/javascript' src='https://www.mydomain.co.uk/wp-content/plugins/contact-form-7/scripts.js?ver=3.0.1'></script>
    
    </body>
    </html>

    (My static pages show up fine)

    Thanks

    write the file path directly to single.php

    And why would you do that?

    Thread Starter wambamboo

    (@agatha1)

    Well, the same error occurs if I just write https://www.mydomain.com/single.php in the address bar.

    I was just wondering if it’d help get to the root of the problem if I wrote out the whole path. Clearly not.

    No, Never reference a template file directly in a url. That’s just not the way WordPress works. What happens if you just use Twenty Eleven and navigate normally? Can you post a link to your site so that we can see this?

    Thread Starter wambamboo

    (@agatha1)

    Ok – thanks.

    I only have static pages on the site at the moment (I’m holding off putting up a blog page while I work on these errors)and there are no obvious errors when navigating around the site, whichever theme I use.

    I could send a link privately but I’d really rather not post my URL here if you don’t mind – if that compromises the amount of help I can get on here then so be it.

    Thread Starter wambamboo

    (@agatha1)

    I’m beginning to wonder if it could be a problem with the hosting company (Fasthosts).

    there are no obvious errors when navigating around the site

    So are these issues only with Posts?

    Thread Starter wambamboo

    (@agatha1)

    Do you know what, I’ve done some test posts and a test page of posts and it seems to all work fine. I only get the error:

    Fatal error: Call to undefined function get_header() in /home/fhlinux199/y/mydomain.co.uk/user/htdocs/wp-content/themes/Starkers/single.php on line 10

    when I write the whole path to single.php. I don’t know if that’s a problem (it doesn’t appear to be)but I think you taught me a very important thing when you said this:

    No, Never reference a template file directly in a url. That’s just not the way WordPress works.

    So thanks for that.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Fatal error in single.php and others’ is closed to new replies.