• looking for the cause or solution for the below:

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

    Trying to view this page but get this error.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The index.php file located in the themes directory is intended to render a blank page. It is there to prevent casual browsing of your themes directory in the event that your server configuration doesn’t. If you have attempted to edit that file, you can replace it with a fresh one by just copying and pasting from the one in your plugins directory. They are identical. This is the only code that should appear in that file;

    <?php
    // Silence is golden.
    ?>

    Thread Starter tbenton

    (@tbenton)

    Aww yess I have seen that file. So to get this right. Copy from the plugins directory the similiar INDEX php File and paste in where the old php file is?

    Thanks

    That should do it. Just copy the index.php file that’s located in the plugins directory, and use it to replace the one located in the themes directory. Then when you try to access it from a browser you should just get a blank page.

    Thread Starter tbenton

    (@tbenton)

    Clayton,
    Got home and tried this not sure if it correct, I see this

    <?php
    // Silence is golden.
    ?>

    For live view it is a blank page. Is this correct?

    Looks like you have it. The code appears correct and the blank (all white) page is the normal/expected behavior when you view it in a browser.

    Yes – that’s correct.

    Thread Starter tbenton

    (@tbenton)

    Thanks you guys are awsome. I will try to go to the next step. If i have problems I will ask you again. Thanks again..

    Thread Starter tbenton

    (@tbenton)

    something else poped up…

    Parse error: syntax error, unexpected T_ENDWHILE in C:\xampp\htdocs\wp-content\index.php on line 35

    and

    Parse error: syntax error, unexpected T_ENDID in C:\xampp\htdocs\wp-content\index.php on line 35

    I do not have a clue the code looks correct

    What exactly are you doing that is accessing the index.php files located in the /themes or /wp-content directories? Those index.php files in particular, are just dummy files that contain the same “silence is golden” php code we talked about above, and are only intended to prevent people from casually browsing those directories in the event that you have not configured your server to prevent it. There is actually never any real reason to edit them, or even access them, and WordPress itself does not use those files in the course of its normal operation. As far as I know, they don’t do anything except intentionally render a blank page if pulled up in a browser. What are you doing that makes your browser keep trying to access them?

    Thread Starter tbenton

    (@tbenton)

    I am just trying to view this page in live view. You are coorect even if i delet these the page is still blank. I will start from the begining.

    Thread Starter tbenton

    (@tbenton)

    Clayton,
    Just so you know I was working in this tutorial.

    https://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt3.html

    Good or Bad?

    Tim

    While I’m not a frequent Dreamweaver user, lots of people have a great deal of success with it. I think you probably have the right idea, but what you might need to do is restrict your editing to just what is inside a specific theme directory. The only files you will need to edit for your site would be files in whatever theme you chose to use. For example, if you installed and activated the Graphene theme, and decided that you want to modify it to better suit your needs, you would only want to edit files located in /wp-content/themes/graphene. If you are creating your own theme, your working directory would be /wp-content/themes/your_theme.

    So in short, customizing your sites theme using Dreamweaver, would probably mean editing only files found inside of your actual (active) theme directory. Not /wp-content/themes, but /wp-content/themes/your_theme_name. Editing anything else will in most cases, cause issues and errors with WordPress.

    Thread Starter tbenton

    (@tbenton)

    Clayton,
    I have done everything again. The problem I am now having is when I install a wordpress theme I should be able to view it through/by typing localhost in the browser. But my problem is it goes back to the XAMMP Page. Have you heard of this before?

    You should have installed WordPress in its own folder inside the htdocs directory. Example: /htdocs/wordpress/ Then you could access it at //localhost/wordpress

    Because XAMPP is intended for local development, the htdocs folder already contains files that allow you to access your database using phpMyAdmin, and other important tools and information for/about your XAMPP server. Installing WordPress files directly into the htdocs directory is not going to work for you. You should install it in a sub-directory.

    A quick walk-through with some visual examples using XAMPP version 1.7.x: https://wplift.com/how-to-setting-up-wordpress-locally-using-xampp/

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Fatal Error Solution’ is closed to new replies.