I'm building theme and using this link in navigation bar to about.php
page.
<li><a href="<?php echo get_template_directory_uri(); ?>/about.php">אודות</a></li>
Now I can't understand why but when I enter about.php
I get the following error:
Fatal error: Uncaught Error: Call to undefined function get_header() in D:\XAMPP\htdocs\wordpress\wp-content\themes\photography\about.php:2 Stack trace: #0 {main} thrown in D:\XAMPP\htdocs\wordpress\wp-content\themes\photography\about.php on line 2
About.php page
<?php get_header(); ?>
<?php get_footer(); ?>
I'm not sure if I need to define something in my functions.php file.
How can I load properly get_header();
function in about.php?
I'm building theme and using this link in navigation bar to about.php
page.
<li><a href="<?php echo get_template_directory_uri(); ?>/about.php">אודות</a></li>
Now I can't understand why but when I enter about.php
I get the following error:
Fatal error: Uncaught Error: Call to undefined function get_header() in D:\XAMPP\htdocs\wordpress\wp-content\themes\photography\about.php:2 Stack trace: #0 {main} thrown in D:\XAMPP\htdocs\wordpress\wp-content\themes\photography\about.php on line 2
About.php page
<?php get_header(); ?>
<?php get_footer(); ?>
I'm not sure if I need to define something in my functions.php file.
How can I load properly get_header();
function in about.php?
2 Answers
Reset to default 1Look into the theme template hierarchy. There is no "about.php" file and you should not link to any of the theme (PHP) files directly. Instead, you would create a theme file such as "page-about.php" and create its content in wp-admin as a Page with the slug "about," and WordPress will process that Editor content within the PHP file to create the final visible page. If you have pretty permalinks enabled you will want to link to "/about/" instead of the theme file, but because you have named the PHP file "page-about," WP will apply it to a Page with the slug "about."
get_header()
is part of wordpress core.
Seems your wordpress files damaged or installed incorrect. Try to reinstall it.
Probably you should move D:\XAMPP\htdocs\wordpress
into D:\XAMPP\htdocs\