BCIT Class Materials

I’m teaching two classes on WordPress at BCIT Friday August 21st. Below are the key code snippets along with a zipped archive of the famous Twitter box featured on this blog and in Computer Arts Magazine.

Replace the default heading with a clickable image

<h1 id="blog-title">
<a href="<?php echo get_bloginfo('url') ?>/" title="<?php get_bloginfo('name') ?>" rel="home">
<img alt="Alternate image text" src="<?php echo get_bloginfo('template_url') ?>/imageFolder/imageFile.type" /></a></h1>

The get_bloginfo(); template function

<?php
 echo get_bloginfo('$show')
?>

Where $show can be name, description, url, template_url etc. Full explanation in the WordPress Codex.

Custom Page Template

<?php
/*
Template Name: Whatever
*/
?>

Standard PHP Include

<?php include ('fileName.php'); ?>

Insert Custom Field in Template

<?php echo get_post_meta($post->ID, '$key', true); ?>

Conditional Custom Field

<?php  
	if((get_post_meta($post->ID, 'divName', true))) { ?>
		<div id="divName">
			<?php echo get_post_meta($post->ID, 'divName', true); ?>		
		</div>
	<?php } 
?>

The Twitter Box

Click here to download a zipped archive of the Twitter box. Remember to change the username inside twitter.php, otherwise you’ll get my tweets on your site!

Morten Rand-Hendriksen is a web designer, developer and educator specializing in WordPress and Expression Web. He has published three books and two video series on web design with more coming, he runs a boutique style digital media company called Pink & Yellow Media and he spends a lot of his time thinking about and sharing his knowledge of the internet, information philosophy and web design and development.
Recent Related Posts
  • http://www.designisphilosophy.com/news/frugalbits-com-wordpress-as-a-magazine-cms-20100405/ Building a magazine style theme for Frugalbits.com | Design is Philosophy – The Pink &amp Yellow Media Blog

    [...] style. I chose to go hard core on this one and just write it right into the single template using a conditional custom field. The result was the nice chunk of code below which produces a nice CSS styled box with the author [...]