WordPress WordPress Theme Development WordPress Header and Footer Templates The header.php and footer.php Files

Kelvin Loney
Kelvin Loney
4,280 Points

My index.php doesn't display at all

HERE IS MY CODE

INDEX.PHP

<?php get_header(); ?>

<h1>Index file</h1>

<?php get_footer(); ?>

HEADER.PHP

<p>Header</p>

FOOTER.PHP

<p>Footer</p>

FUNCTIONS.PHP

<?php


function wpt_theme_styles() {
  wp_enqueue_style('foundation_css', get_template_directory_uri() . '/css/foundation.css');
  wp_enqueue_style('normalize_css', get_template_directory_uri() . '/css/normalize.css');
  wp_enqueue_style('normalize_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic');
  wp_enqueue_style('main_css', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'wpt_theme_styles');


function wpt_theme_js() {
  wp_enqueue_script('modernizr_js', get_template_directory_uri() . '/js/modernizr.js', '', '', false );
  wp_enqueue_script('foundation_js', get_template_directory_uri() . '/js/foundation.min.js', array('jquery'), '', true );
  wp_enqueue_script('main_js', get_template_directory_uri() . '/js/app.js', array('jquery', 'foundation_js'), '', true );
}
add_action('wp_enqueue_scripts', 'wpt_theme_js');



?>

2 Answers

John Lack-Wilson
John Lack-Wilson
8,163 Points

Hard to tell why this might be without looking at your folder structure, is the index.php file in the correct location?

Kelvin Loney
Kelvin Loney
4,280 Points

Hi John. I believe it is. The index.php file is located in the first tier of my folder. So to give you some context, in the first tier I have index.php, footer.php, header.php, functions.php, style.css, css folder, and js folder. If you need further information please let me know.

John Lack-Wilson
John Lack-Wilson
8,163 Points

Sounds correct to me. The other thing I can think of is that do you have your server (MAMP or such) started and running? And also configured to work with the WordPress install?

Kelvin Loney
Kelvin Loney
4,280 Points

I do have my MAMP running. I also believe it is configured to the WordPress install. I never had an issue with the method that I used to install.

John Lack-Wilson
John Lack-Wilson
8,163 Points

Hmmm, very odd. Hopefully someone will be able to solve it for you. Sorry I couldn't be more helpful!

Kelvin Loney
Kelvin Loney
4,280 Points

That's fine. Thanks anyway John!