php - Why am I getting Uncaught Error: Call to undefined function get_header()?
one text
I have a the latest version of WordPress installed into my htdocs folder. I try to visit the page by going to http://localhost/wordpress/wp-content/themes/newtheme/front-page.php and it gives me the error.
Error: Call to undefined function get_header()?
I've looked through all of the questions and most of them say to install WordPress locally which I obviously have done. I reinstalled it thinking I might have a bad install. I'm not sure what I'm doing wrong. I'm assuming this is why my CSS themes aren't showing when I visit the site in the dashboard as well but if anyone has an answer for that too that would be great.
header.php:
<!DOCTYPE html>
<html>
<head>
<?php wp_head();?>
</head>
<body <?php body_class();?>>
<header class="sticky top">
</header>
functions.php
<?php
function load_stylesheets()
{
wp_register_style('bootstrap',
get_template_directory_uri() . '/css/bootstrap.min.css'
, array (), false, 'all');
wp_enqueue_style('bootstrap');
wp_register_style('style', get_template_directory_uri()
. 'style.css' , array (), false, 'all');
wp_enqueue_style('style');
}
add_action('wp_enqueue_scripts', 'load_stylesheets');
function include_jquery()
{
wp_deregister_script('jquery');
wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-3.5.1.min.js', '', 1, true);
add_action('p_enqueue_scripts', 'jquery');
}
function loadjs()
{
wp_register_script('customjs',
get_template_directory_uri() . '/js/scritps.js', '', 1,
true);
wp_enqueue_script('customjs');
}
add_action('wp_enqueue_scripts', 'loadjs');
front-page.php
<div class="container pt-5 pb-5">
<h1><?php the_title();?></h1>
<?php if (have_posts()) : while (have_posts()) :
the_post();?>
<?php the_content();?>
<?php endwhile; endif;?>
</div>
<?php get_footer();?>
Source