Forums

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

Home Forums Back End I Need Help

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #148087
    CodeGraphics
    Participant

    I should have posted this in PHP section, but each time I select PHP section I will be logged out. Certainly a bug.

    [Mod edit: moved to PHP section]

    I have a little PHP problem.

    I am beginning to learn wordpress. I have created my header.php and added it at the top of my index.php like this:

      <?php get_header(); ?>
    

    But I got this error:

    Fatal error: Call to undefined function get_header() in C:\wamp\www\wordpress\wp-content\themes\mytheme\index.php on line 1

    But when I used:

      <?php include 'header.php'; ?>
    

    It worked fine. What could be the cause?

    #148089
    __
    Participant

    get_header is a WP-defined function. Are you viewing the page via wordpress, or are you trying to view it directly?

    …each time I select PHP section I will be logged out.

    Clear your browser cache (or try [Ctrl]+[R]).

    #148091
    CodeGraphics
    Participant

    I am on a localhost.
    My url looks like this:

    http://localhost/wordpress/wp-content/themes/mytheme

    #148109
    Senff
    Participant

    That’s not how you should view pages within a WordPress install. If done correctly, it should just be http://localhost

    It’s kind of the same when you go visit CSS-tricks (also WordPress) through https://css-tricks.com/wp-content/themes/CSS-Tricks-10/

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