Code snippets from my WordCamp presentation

Here are some code snippets from my WordCamp Whistler presentation. This article will be expanded in the coming week but in the meantime here they are for anyone wanting to play around with them:

Custom Page Templates in 5 lines of code

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

Custom Fields in one line of code

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

Custom Field that parses PHP code

<?php $boxContent = get_post_meta($post->ID, 'centerBox', true); ?>
<?php eval('?'.'>'.$boxContent); ?>
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.vancouverpolicemuseum.ca/weblog/ Chris Mathieson

    Not officially sent by NetChick (this round) but thought I’d check all the other blogs out. Then I realized that I’m glad I came here to offer a “thank you” for the video you guys (Dabbler) did for us a year and a bit ago. Hurray!

    Anyway, I’ll definitely add you to my feed reader now. :)

    C.

  • http://www.pinkandyellow.com Morten Rand-Hendriksen

    Hey! The philosopher from the police museum! Nice to hear from you again. Are you on twitter? Maybe the police museum should be?

  • http://www.cssenvy.com/random Envy

    Great articles & Nice a site…

  • http://www.the-music-for-free.info/gt/developer/great-designers-and-developers/wordcamp-victoria-presentation-10-theme-hacks-to-improve-your-site/ WordCamp Victoria Presentation: 10 Theme Hacks to Improve Your Site | The best Tutorials

    [...] Code snippets from my WordCamp presentation anchor tag, custom menu, custom menus, depth explanation, gist, hacks, header image, header php, home button, home url, image code, image link, menu function, menu name, pet peeve, php echo, root url, simplicity, slug, wordpress [...]