Support » Fixing WordPress » Template is missing error

  • I’m designing and developing a theme from scratch. No parent/no child. Just a simple theme based on the HTML code.

    After getting absolutely nowhere with XAMPP to do things locally, I uploaded to the server.

    When I go into the WP admin > Appearance > Themes, my theme doesn’t appear, but down at the bottom I have the following error:

    Broken Themes

    The following themes are installed but incomplete. Themes must have a stylesheet and a template.
    Name Description
    eztile/css Template is missing. Delete

    So, why?

    My style.css is in the root folder, not in a styles folder.

    The folder for my theme, under the /wp-content/themes folder, is called /eztile, after the name of the company I’m designing the site for.

    Here’s the top portion of the styles sheet:

    /*
    Theme Name: eztile
    Version: 1.0
    Description: A magazine-style theme for WordPress
    Author: rgwhitaker
    */
    
    body {
    	background-color: #fff;
    }
    
    /** MAIN WRAPPER **/
    
    #wrapper {
    	width: 950px;
    	margin: 0 auto;
    	padding: 0;
    }
    
    /** TOP BAR **/
    
    #top-bar {
        height: 140px;
        margin-bottom: 0;
    	background: none;
    	display: table;
    	width: 950px;
    	margin: 0 auto;
    	position: relative;
    	border-bottom: 2px solid gray;
    }

    Here’s the top portion of the header.php file:

    <!doctype html>
    
    <html lang="en">
    <head>
      <meta charset="utf-8">
    
      <title><?php wp_title( '|', true, 'right' ); ?></title>
      <meta name="description" content="EZ Tile and Marble">
      <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    		<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
    		<!--[if lt IE 9]>
    		<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
    		<![endif]-->
    		<?php wp_head(); ?>
    </head>
    
    <div id="wrapper">
    
    	<!-- HEADER/NAV AREA -->
    
    		<header id="top-bar" class="clear">
    			<div id="hgroup">
    				<a href="index.html"><img src="img/logo.png" width="250" height="195" /></a>
    			</div>

    And here’s the index.php file:

    <?php get_header(); ?>
    
    <!-- MAIN CONTENT SECTION -->
    	<section id="mainpage_content_area">
    
    		<div class="content">
    			<?php if ( have_posts() ) : ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    					<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    						<div class="post-header">
    							<div class="date"><?php the_time( 'M j y' ); ?></div>
    							<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    							<div class="author"><?php the_author(); ?></div>
    						</div><!--.post-header-->
    						<div class="entry clear">
    							<?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail(); ?>
    							<?php the_content(); ?>
    							<?php edit_post_link(); ?>
    							<?php wp_link_pages(); ?>
    						</div>
    						<!--. entry-->
    
    						<footer class="post-footer">
    							<div class="comments"><?php comments_popup_link( 'Leave a Comment', '1 Comment', '% Comments' ); ?></div>
    						</footer>
    						<!--.post-footer-->
    					</div>
    					<!-- .post-->
    
    				<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
    					<nav class="navigation index">
    						<div class="alignleft"><?php next_posts_link( 'Older Entries' ); ?></div>
    						<div class="alignright"><?php previous_posts_link( 'Newer Entries' ); ?></div>
    					</nav>
    					<!--.navigation-->
    
    				<?php else : ?>
    			<?php endif; ?>
    		</div>
    		<!--.content-->
    
    		<aside>
    			<?php get_sidebar(); ?>
    		</aside>
    
    	</section>
    
    <?php get_footer(); ?>

    The error says that the template is missing. I thought that a template file was merely an index.php file?

    Any ideas?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • OK. Something I noticed in the Appearance > Themes screen.

    Why is it calling my theme eztile/css? It should be just eztile. I thought I’d force it to look at my root directory for the css file so I named the css folder to /old.

    Then, when I logged back into WP Admin, the Appearance > Themes screen showed the name of my theme as eztile/old.

    What’s going on?

    My style.css is in the root folder, not in a styles folder.

    It’s supposed to be located directly inside the theme’s own folder (e.g., /wp-content/themes/eztile), not in the root folder of your site.

    Why is it calling my theme eztile/css?

    If you actually put the style.css file in a folder named css, and that folder is located inside the /wp-content/themes/eztile folder, then the name would be displayed that way (because again, the style.css file belongs right inside the theme’s own folder, so having it in a subfolder confuses WordPress).

    The error says that the template is missing. I thought that a template file was merely an index.php file?

    The index.php file and the style.css file have to be in the same folder (which, as already explained above, is the /wp-content/themes/eztile folder) in order for them to both be recognized as belonging to the same theme.

    See also Theme Development: Anatomy of a Theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Template is missing error’ is closed to new replies.