This section covers basic WordPress code that can be just dropped into your site and it will work right away.
All pages should start with:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div><?php the_content(); ?></div><?php endwhile; else: ?>
<p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
<?php endif; ?>
Title:
<?php the_title(); ?>
Content:
<?php the_content(‘Read on… ‘); ?>
Excerpt (displays small snippet if the post if no MORE tag is used)
<?php the_excerpt(); ?>
Previous Post Link: (lists only posts in current category)
<?php previous_post_link(‘%link’, ‘%title’, TRUE); ?>
Next Post Link: (lists only posts in current category)
<?php next_post_link(‘%link’, ‘%title’, TRUE); ?>
Comments:
<?php comments_template( ”, true ); ?>
Primary Widget Area (sidebar)
<?php if ( ! dynamic_sidebar( ‘primary-widget-area’ ) ) : ?>
<?php endif; ?>
Secondary Widget Area (sidebar)
<?php if ( is_active_sidebar( ‘secondary-widget-area’ ) ) : ?>
<?php dynamic_sidebar( ‘secondary-widget-area’ ); ?>
<?php endif; ?>
Custom Category (sidebar)
<h1><?php _e(‘Categories’); ?></h1>
<ul>
<?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0’); ?>
</ul>
Blog name and link to home page. Used in footer:
<a href=”<?php echo home_url( ‘/’ ); ?>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”>
<?php bloginfo( ‘name’ ); ?>