Fatal error: Call to undefined function get_header() error

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Fatal error: Call to undefined function get_header() error

Postby rgwhitaker » 02. January 2016 21:57

I'm hoping to get some assistance here. I've searched in so many places for a resolution and simply cannot find one anywhere. At least one that is relevant to my situation.

I just downloaded and installed XAMPP 5.6.15. I then downloaded and unzipped WordPress 4.4 into the c:\xampp\htdocs\ folder.

I go into the XAMPP control panel and start Apache, then I start MySQL. They both seem to start fine. If I then enter http://localhost at this point in my browser, I am able to get to the XAMPP screen.

I'm trying to create a simple WordPress blog for a client. So I created an HTML file, that I renamed to index.php. I then have a header.php file in the same folder. Oh, and by the way, the folder, called /eztile, is found here: c:\xampp\htdocs\wordpress\wp-content\themes\.

I then attempted to open the index.php file within the browser by entering the following in the address bar of my browser:

http://localhost/wordpress/wp-content/themes/eztile/index.php.

I immediately received the following error:

Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\wordpress\wp-content\themes\eztile\index.php on line 21

Here's the top code of my index.php file:

Code: Select all
<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>EZ Tile and Marble | Home</title>
  <meta name="description" content="EZ Tile and Marble">
  <link rel="stylesheet" href="css/styles.css">
  <link rel="stylesheet" href="css/slider.css">   

  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>

<body>

<?php get_header(); ?>

      <div id="slider">
         <p><img src="img/slider_holder.png" width="950" height="300" /></p>
      </div>

<!-- MAIN CONTENT DIVIDER -->


And here's the code for my header.php file:

Code: Select all
<div id="wrapper">

   <!-- HEADER/NAV AREA -->

      <header id="top-bar" class="clear">
         <div id="hgroup">
            <a href="index.html"><img src="img/logo.png" width="250" height="195" /></a>
         </div>

         <nav id="menu">
            <ul id="drop-nav">
               <li><a href="about-us.html">About Us <span class="arrow">&#9660;</span></a>
                  <ul>
                     <li><a href="testimonials.html">Testimonials</a></li>
                     <li><a href="why-ez-tile-and-marble.html">Why EZ Tile & Marble</a></li>
                     <li><a href="things-to-consider.html">Things To Consider</a></li>
                  </ul>
               </li>
               <li><a href="quote-request.html">Quote Request <span class="arrow">&#9660;</span></a>
                  <ul>
                     <li><a href="stone-types.html">Stone Types & Edges</a></li>
                     <li><a href="project-estimation-form.html">Project Estimation Form</a></li>
                     <li><a href="granite-colors.html">Granite Colors</a></li>
                  </ul>               
               </li>
               <li><a href="portfolio.html">Portfolio <span class="arrow">&#9660;</span></a>
                  <ul>
                     <li><a href="project-inspiration.html">Project Inspiration</a></li>
                     <li><a href="videos.html">Videos</a></li>
                  </ul>               
               </li>
               <li><a href="blog.html">Blog <span class="arrow">&#9660;</span></a>
                  <ul>
                     <li><a href="countertop-and-tile-installation.html">Countertop and Tile Installation</a></li>
                  </ul>               
               </li>
               <li><a href="blanco-sinks.html">Blanco Sinks</a></li>
               <li><a href="stone-remnants.html">Stone Remnants</a></li>
               <li><a href="contact-us.html">Contact Us</a></li>
            </ul>
         </nav>
      </header>


I know that some people have had this issue when they've modified and/or changed/moved the index.php file within /wordpress. I have not moved and/or modified any of the files. NONE.

So, out of curiosity, I thought I'd try to see if I could go into any of the free themes that come with WordPress 4.4 (twentysixteen, twentyfifteen, twentyfourteen). I tried each and received the same error:

Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\wordpress\wp-content\themes\twentysixteen\index.php on line 17

If I try twentyfifteen or twentyfourteen, just replace twentyfifteen or twentyfourteen in the line above.

I don't know where else to go or what to do at this point! I've got to get this going for my client. I want to be able to design, develop, and test this on my local machine.

What else can I do? I'm hoping someone here with more experience (and XAMPP/Apache/PHP/WordPress knowledge) will be able to help me.

Thank you.

QUICK UPDATE:

After posting this, I realized something when doing a little more research. To call my header, should I be just doing a simple include? That's really all I want to do? Or is the get header() the right thing to do to call up the menu on each page? Same with footer.
rgwhitaker
 
Posts: 4
Joined: 18. June 2010 18:56

Re: Fatal error: Call to undefined function get_header() err

Postby Nobbie » 02. January 2016 22:09

rgwhitaker wrote:I don't know where else to go or what to do at this point!


I would suggest a wordpress forum, as this is a pure wordpress issue, not a Xampp issue.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 82 guests