Limit Post Class

If you use source view to view your content, you may have noticed the WordPress post_class can get out of hand. Adding this to your functions.php file will give you control over the output:
function hdg_category_id_class( $classes ) {
global $post;
foreach( ( get_the_category( $post->ID ) ) as $category )
$classes[] = $category->category_nicename;
return array_slice( $classes, 0,5 ); // currently set to 5
}
add_filter( 'post_class', 'hdg_category_id_class' );

Menu CSS

#menu-main,#menu-main * {
list-style:none;
margin:0;
padding:0;
}
#menu-main {
line-height:1.0;
float:left;
margin-bottom:1em;
}
#menu-main ul {
position:absolute;
top:-999em;
width:10em;
}
#menu-main ul li {
width:100%;
}
#menu-main li:hover {
visibility:inherit;
z-index:1;
}
#menu-main li {
float:left;
position:relative;
z-index:1;
background:none;
}
#menu-main a {
display:block;
position:relative;
text-decoration:none;
padding:.75em 1em;
}
#menu-main li:hover ul {
left:0;
top:2.5em;
z-index:1;
}
#menu-main a,#menu-main a:visited {
color:#a5a69e;
}
#menu-main li li {
background:#fff;
color:#fff;
text-align:left;
opacity:0.8;
}
#menu-main li li:hover {
background:#ebebeb;
opacity:0.9;
}
ul#menu-main li ul {
border:1px solid #DCDCDC;
}
#menu-main li li li {
background:#fff;
}
#menu-main li:hover,#menu-main li.sfHover,#menu-main a:focus,#menu-main a:hover,#menu-main a:active {
outline:0;
color:#3A3A3A;
}
ul#menu-main li:hover li ul,ul#menu-main li li:hover li ul {
top:-999em;
}
ul#menu-main li li:hover ul,ul#menu-main li li li:hover ul {
left:10em;
top:0;
}
#menu-main .current_page_item a,#menu-main .current_page_item a:visited,#menu-main li.current,#menu-main li a.current {
color:#3A3A3A;
}

 

Display Template Used

Add this to your functions.php file to display the current page template.

Note:
The theme file message is only visible to logged in users.

<?php
// Show Theme File
  function getWpTemplate() {
    if (defined('wp_USE_THEMES') && wp_USE_THEMES) {
    $template = false;
    if     (is_404()       && $template = get_404_template()):
    elseif (is_search()        && $template = get_search_template()):
    elseif (is_tax()            && $template = get_taxonomy_template()):
    elseif (is_front_page()        && $template = get_front_page_template()):
    elseif (is_home()           && $template = get_home_template()):
    elseif (is_attachment()        && $template = get_attachment_template()):
    elseif (is_single()            && $template = get_single_template()):
    elseif (is_page()           && $template = get_page_template()):
    elseif (is_category()        && $template = get_category_template()):
    elseif (is_tag()             && $template = get_tag_template()):
    elseif (is_author()         && $template = get_author_template()):
    elseif (is_date()           && $template = get_date_template()):
    elseif (is_archive()        && $template = get_archive_template()):
    elseif (is_comments_popup() && $template = get_comments_popup_template()):
    elseif (is_paged()          && $template = get_paged_template()):
    else:
    $template = get_index_template();
    endif;
    return str_replace(ABSPATH, '', $template);
    } else {
    return null;
    }
}
function outputThemeFilename() {
    global $stfOptions;
    echo '<div id="templateUsed"
    style="position: absolute;
    z-index: 9999;
    padding: 3px;
    background: white;
    color: black;
    top:0;
    right:0;
    opacity: 0.8;">';
    echo (getWpTemplate() !== null) ? getWpTemplate() : 'Unknown theme file';
    echo '</div>';
    return;
  }
$stfOptions = array('require_admin' => true);
if ($stfOptions['require_admin'] == true) {
  if (current_user_can('administrator')) {
    add_action('wp_head', 'outputThemeFilename');
    }
  } else {
  add_action('wp_head', 'outputThemeFilename');
  }
?>

Members Only Page

Show Content To Logged In Users Only
<?php
/*
Template Name: Members only page
*/
?>
<?php get_header(); ?>
<?php if (is_user_logged_in()) { ?>
  <div id="contents">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <h2 class="title" id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
    <?php the_content(__('Read the rest of this page &amp;raquo;')); ?>
    <?php endwhile; endif; ?>
  </div>
<?php comments_template(); ?>
<?php } else {
// they aren't logged in, so show them the login form ?>
  <div id="contents"><p>
    I'm sorry, but you must be a logged in member to view this page.
    Please either login below or  
    <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register">Register</a> today.</p>
  </div>
  <form name='loginform' id='loginform' action='<?php bloginfo('wpurl'); ?>/wp-login.php' method='post'>
    <p><label>Username<br />
      <input type='text' name='log' id='log' value='' size='20' tabindex='1' />
    </label></p>
    <p><label>Password<br />
      <input type='password' name='pwd' id='pwd' value='' size='20' tabindex='2' />
    </label></p>
    <p><label>
      <input name='rememberme' type='checkbox' id='rememberme' value='forever' tabindex='3' />Remember Me
    </label></p>
    <p class='submit'>
      <input type='submit' name='submit' id='submit' value='Login &amp;raquo;' tabindex='4' />
      <?php //use a hidden field to return them to the page they came from ?>
      <input type="hidden" name="redirect_to" value="<?php echo $_SERVER["REQUEST_URI"]; ?>" />
    </p>
  </form>
  <?php  } ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Dynamic Copyright

Add Dynamic Copyright To Your Theme:
<?php
function my_dynamic_copyright() {
  global $wpdb;
  $copyright_dates = $wpdb->get_results("SELECT YEAR(min(post_date_gmt))
  AS firstdate,YEAR (max(post_date_gmt))
  AS lastdate FROM$wpdb->posts
  WHERE post_status = 'publish' " );
  $output = ''; if($copyright_dates) {
     $copyright = "&copy; " . $copyright_dates[0]->firstdate;
     if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
       $copyright .= '-' . $copyright_dates[0]->lastdate;
       }
     $output = $copyright;
     }
  return $output;
  }
?>
<?php // PLACE THIS IN THE FOOTER: echo my_dynamic_copyright(); ?>

All Posts Dropdown

<form action="<?php bloginfo('url'); ?>" method="get">
  <select name="page_id" id="page_id">
    <?php
      global $post;
      $args = array( 'numberposts' => -1);
      $posts = get_posts($args);
      foreach( $posts as $post ) : setup_postdata($post);
      ?>
    <option value="<?php echo $post->ID; ?>"><?php the_title(); ?></option>
    <?php endforeach; ?>
  </select>
  <input type="submit" name="submit" value="view" />
</form>

List Posts In Specific Category

<?php
  $args = array(
    'numberposts' => 3,
    'order'=> 'DESC',
    'orderby' => 'post_date',
    'category' => 7
    );
  $postslist = get_posts( $args );
  foreach ($postslist as $post) :  setup_postdata($post);
  ?>
  <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php endforeach; ?>

Conditional Pagination

<?php global $wp_query;
  if ($wp_query->max_num_pages > 1) { ?>
    <div class='navigation'>
      <span class='older'><?php next_posts_link('&amp;laquo; Older Entries'); ?></span>
      <span class='newer'><?php previous_posts_link('Newer Entries &amp;raquo;'); ?></span>
    </div>
  <?php } ?>

Add Post Thumbnails

<?php //for functions.php file
  add_theme_support( 'post-thumbnails' );
  ?>
 
<?php // For the template add this (usually just after the_title(); ?>
<?php the_post_thumbnail( 'thumbnail' ); ?>

The Loop

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  <div id="post-<?php the_ID(); ?>">
  <h2>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php the_title(); ?></a>
  </h2>
    <small>
      <?php the_time('F jS, Y') ?>  by <?php the_author() ?>
    </small>
    <div>
      <?php the_content('Read the rest of this entry »'); ?>
    </div>
    <p>Posted in <!--?php the_category(', ') ?--><strong>|</strong>
      <?php edit_post_link('Edit','','<strong>|</strong>'); ?>
      <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    </p>
  </div>
<?php endwhile; ?>
<div>
  <div>
    <?php next_posts_link('« Previous Entries') ?>
  </div>
  <div>
    <?php previous_posts_link('Next Entries »') ?>
  </div>
</div>
<?php else : ?>
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>