• I have been trying to solve this problem and checking the forums to find solutions, but even if sometimes the problem has been solved, I have no clue. I am using XAMPP to work with the localhost. I am using a customized template. I have siteurl and home links set in DB in phpmyadmin correctly for the localhost. I can see the main page of my site perfectly. However, the links from the website are not working.

    In the template folder I have a index.php file which calls a header.php, footer.php and sidebar.php. All these three files called are located in the same template folder. The sidebar file call to a customized guide.php file, located in the same folder as well. The error is not appearing when loading index.php, but when loading guide.php, as I said called in the sidebar.php. I checked the sidebar file and the call to the guide file states like follows:

    <div class="txt">
    			<h4>Visit our product guide</h4>
    			<a href="<?php bloginfo('template_directory'); ?>/guide.php" class="boton">View guide</a>
    		</div>

    When I click on the button link for guide, the Fatal error appears. I read the way I am calling the file (guide.php) is not correct, but I would like to know in a specific way, which changes I have to apply in order to make it work. I am quite a begginer.

    Thank you so much

Viewing 3 replies - 1 through 3 (of 3 total)
  • Normally the files in the your theme directory are templates, not files you call directly. You need to create a standard WordPress page and put the contents of guide.php in that (sans any PHP code).

    Also, let us know that the error message is.

    Thread Starter adminadminadmin

    (@adminadminadmin)

    Yes, I have the guide page created as admin in the WordPress backend. The error is:
    Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\web\wp-content\themes\t\guide.php on line 7

    I’m not quite sure what you’re trying to accomplish, then. You shouldn’t need to call a .php file directly in an href (though in theory you could). It should be a standard WordPress page. If you do indeed want to call a php file, it won’t have any idea what get_header() is without WordPress core being loaded.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘call to undefined function get_header() LOCALHOST’ is closed to new replies.