I started building my own Wordpress theme on my local server using a tutorial that I have successfully used several times before. Wordpress installed fine, the default themes, as well as the Starkers theme, work fine. My bare-bones theme installed and activated with no issues.
But I only got as far as starting my css file, making the basic index.php file with some test content in it … all I get is a blank page (no error messages). I checked and I don’t think it is an issue with permissions, and I can’t find any obvious issues with the code (that doesn’t mean there aren’t any). What could be causing my page to not show up?
Here is my index.php …
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="generator" content="Wordpress <?php bloginfo('version'); ?>" />
<!--<meta name="author" content=""/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>-->
<!-- link to external stylesheet -->
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url') ?>" />
<!--<link rel="stylesheet" type="text/css" href="style.css" media="screen" />-->
<!-- other links -->
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<!--embedded styles -->
<style type="text/css">
</style>
<!--embedded javascript code -->
<script type="text/javascript">
</script>
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
</head>
<body>
<div id = "wrapper">
<div id="header">
<?php bloginfo('name'); ?>
</div><!-- end of header div -->
<div id = "mainContent">
<p class="message">I can't see the title of my blog ... or this ... something is wrong here.</p>
</div> <!-- end of mainContent div -->
<div id="footer">
</div><!-- end of footer div -->
</div> <!-- end of wrapper div -->
</body>
</html>
and here is my css file …
/*
Theme Name: journey
Theme URI: http://localhost/wordpress/themes/journey
Author: ******* **********
Author URI: ********************
Description: This theme is designed for my new blog.
Version: 1.0
*/
.message {
font-weight: bold;
color: red;
}
* {
margin: 0;
padding: 0;
}
body {
background-image: url(images/bkgd.jpg);
background-size: 100%;
background-color: #555;
}
#wrapper {
width: 960px;
height: 800px;
background-color: #ccc;
}
My source code is non-existent also - totally blank. I’m going to check the WP_DEBUG defined variable right now. Thanks.
… You were right - It was set to false - I changed that and got a whole bunch of errors …
"Warning: fopen(http://localhost/wordpress/wp-cron.php?doing_wp_cron) [function.fopen]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\wordpress\wp-includes\class-http.php on line 876
Notice: Use of undefined constant amt_cif - assumed ‘amt_cif’ in C:\xampp\htdocs\wordpress\wp-config.php on line 91
Notice: Use of undefined constant amt_gp - assumed ‘amt_gp’ in C:\xampp\htdocs\wordpress\wp-includes\vxthdkga.php on line 3"
Most of them were like the last one - undefined variables in vxthdkga.php
I have figured out that vxthdkga.php, a line added to the end of my wp-config.php file, and three database tables were added when I downloaded the free themes for testing, so that problem was solved by deleting them.
I’m still left with the issue of my index.php not displaying, when the default themes are working just fine.
It sounds like you have a fatal error that is stopping the output.
A totally blank page usually suggests that all error_reporting is switched off - you need to switch it on and it should tell you what the problem is.
I always keep error reporting on because I do quite a bit of php developing, but I double checked just in case … it’s still on. I ended up just wiping out my wordpress, database and all and I’ll start over again. Thanks for your help … I’ll be back again if the problem shows up on my second attempt.
I did find some suspicious code in a few of the templates that I downloaded for testing … won’t let that happen again. Sometimes we learn the hard way.
Did you port your database from a live site to localhost? If so, you will need to change the domain within wordpress, since wordpress doesn’t always recognize the change automatically.
No I made a new database in localhost. I use phpMyAdmin. The database is set up properly, and as I mentioned before, the default themes and Starkers work just fine, even with the test data imported from Wordpress. It’s just my theme that won’t work. I don’t understand why. Is there anything wrong or outdated about my code above? The tutorial is from 2007.
By the way, I totally wiped out my first attempt, and re-downloaded Wordpress and started from scratch, just in case it didn’t download properly the first time. I’m still getting the blank page.
2007? Yikes. Wordpress has gone through some significant changes in the past year alone. A tutorial from 2007 would be woefully out of date and would not be useful for you.
I would recommend looking at the 2010 and 2011 default wordpress themes, and the documentation on wordpress.org pertaining to theme development. You probably wouldn’t need to make use of all the individual source files. I would focus on index.php, functions.php, header.php, footer.php, sidebar.php, content.php–those will get you far enough to actually display your content. For comments, you would probably also need comments.php. The other php files just offer different ways to display different types of content, like a single post, a category, an author page, etc.
Glancing at your code, some of the bloginfo values may be depreciated, and the location of your archives function should be in the body, if it hasn’t been depreciated as well. But, there’s a thing called The Loop now, which is responsible for displaying content.
Thanks, I will find another model to follow. I used this tutorial only last year with Wordpress 2.6 and it worked fine. It also uses the loop. I checked all the bloginfo values with the list in the codex and thought they were okay.