• Resolved addnon

    (@addnon)


    I’m trying to create my own theme. The only files are index.php and style.css. Other themes work fine, but when I try this, nothing happens.

    The blog is located at: https://www.stlhood.org

    index.php:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="https://www.w3.org/1999/xhtml">
    
    <head profile="https://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'); ?>" /> <!-- leave this for stats please -->
    
    	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    
    	<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'); ?>" />
    
    	<?php wp_get_archives('type=monthly&format=link'); ?>
    
    	<?php //comments_popup_script(); // off by default ?>
    
    	<?php wp_head(); ?>
    
    </head>
    
    <body>
    
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <?php endwhile; ?>
    <?php endif; ?>
    
    </body>
    
    </html>

    style.css

    /*  
    
    Theme Name: Tutorial
    
    Theme URI: https://www.wpdesigner.com
    
    Description: This is my theme for a tutorial.
    
    Version: 1.0
    
    Author: Small Potato
    
    Author URI: https://www.wpdesigner.com/
    
    */

Viewing 2 replies - 1 through 2 (of 2 total)
  • You need to add other functions. Here is a basic loop. Feel free to replace your own with this one.

    <!-- start the loop -->
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    <?php the_excerpt(); ?>
    
    </div>
    
    <?php endwhile; else: ?>
    
    <p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>
    
    <!-- end the loop -->
    
    <!-- get pagination -->
    
    <?php get_template_part( 'pagination' ); ?>
    Thread Starter addnon

    (@addnon)

    Thank you! I’m out of it today!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Loop not working. Nothing is showing up.’ is closed to new replies.