Add Google Analytics To A WordPress Site

Paste the following code into your functions.php file replacing the UA-xxxxxxxx-x code with your Google Analytics code.

function googleanalytics(){
?>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

<?php
}
add_action('wp_head', 'googleanalytics', 100);

How to list a specific number of posts from 1 category in WordPress

You can place the following code in one of your theme’s template files to list a particular amount of posts from one of your site’s catagories.

<h2>Last 5 Tutorials</h2>
<?php query_posts('category_name=tutorials&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
	<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php the_excerpt(); ?>
<?php endwhile; ?>

Tested with WordPress 3.3