I am a beginner coder working on a WordPress website and have come across a critical error: I have created a header.php file and tried using the get_header() function to import the header into all of my pages. In my index.php page, it works perfectly, but in all of my other pages, I get an error message saying “Fatal error: Uncaught Error: Call to undefined function get_header()”. For experimental purposes, the code in my "index.php" page is the same as in all of my other ".php" pages. What am I doing wrong? Here is the code for one of my pages “feedback.php”:
<!DOCTYPE html>
<html>
<head>
<!-- Import Header from header.php -->
<?php get_header(); ?>
<!-- Basic Responsivness -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width", initial-scale=1.0>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title> Home </title>
<link href="https://fonts.googleapis.com/css2?family=Notable&display=swap" rel="stylesheet">
<style type="text/css">
h2 {
font-family: 'Notable', sans-serif;
}
</style>
</head>
<body>
<h2> Hello World </h2>
</body>
</html>
get_header();- Aliqua