I installed WAMP server on Windows XP - it worked. I installed Wordpress 3.4.2 into www.wordpress
- no problem. In Dreamweaver CS5 I created a site with www.wordpress
as root folder, and assigned a local test server - no problem.
The, in Dreamweaver, I opened twentyten
theme - index.php
- and pressed F12 to see the page in Firefox - and got:
Fatal error: Call to undefined function get_header()... - on line 16
This is a completely new and clear wordpress installation. Why is the function (get_header
) - undefined? To check the server I copied another .php file into the same folder - F12 - it works.
When you click the F12 in Dreamweaver , it will open the file in the browser using the windows local path file system to the file, which wont work as you should run the file on localhost.
Using F12 file will open as C:\\Wamp\Wordpress\index.php
.
But you should rather open it as localhost/wordpress/
.
Also, you should be running index.php
that is in wordpress folder and not the index file that is in themes folder.
You can work on your theme files directly if you were running DesktopServer Premium instead of WAMP. It's the only web server that supports Dreamweaver's WYSIWYG when working with WordPress template files.
The error occurs because you are trying to view the wrong index.php file in your WP hierarchy. The index.php in your theme's folder is not intended to load the all the functions of the WP environment.
Open the top level index.php file in the document root. (The index.php file that is in the same directory as the wp-admin, wp-content, and wp-includes folders.) That file processes everything seen in the browser (or DW live view) when accessing your site via the web url.
You can make changes to your theme by editing the theme's file located at /wp-content/themes/YOUR-THEME
Once you make the changes you can view them by previewing the top-level index.php file.
The correct index.php file you should use to view your site through DW previewing should have the following code only by default.
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '\wp-blog-header.php' );