Code Explosion – Week 3

So I decided to change the name of this weekly post. Weekly Code Roundup was a little too boring, so now we have…CODE EXPLOSION!!! PCKRRR FOOM BABOOOOM *explosion noises* Anyway, onto the code!


When coding an HTML email this week I came across the realization (with the help of @bohach) that some email clients don’t allow you to use short hex codes like #FFF or #000. This led to some confusion but is alleviated by using #FFFFFF or #000000 instead.

Also, Outlook 2007 and 2010 are the most finicky email clients I have ever had to serve, but Brian Scates wrote a great post on how to move past anger and frustration and achieve HTML email nirvana.


Custom Fields can help extend a custom WordPress installation in many different ways. The following snippets are the tip of the iceberg in how what custom fields can do for you.

<?php the_meta(); ?> /* Will output the values for all of your custom fields */

<?php echo get_post_meta($post->ID, 'key', true); ?> /* Outputs specific values when given a specific key */


Previous Post and Next Post buttons can look pretty bland (like on this site), but using the following snippet, you can use CSS to replace text and instead use button images.

<div class="nav">
		<?php if (get_adjacent_post(false, '', true)): // if there are older posts ?>
    		<p class="previous_post">
				<?php previous_post('%','Previous ', 'yes'); ?>
		<?php endif; ?>

		<?php if (get_adjacent_post(false, '', false)): // if there are newer posts ?>
                <p class="next_post">
                               <?php next_post('%', 'Next', 'yes'); ?>
                <?php endif; ?>	


There comes a time in every freelancer’s life where you think about starting your own business. The toughest part of this process after all the legal paperwork is coming up with a name. To come up with a name randomly, I found this article on creating a random name, then adjusted it to meet my own needs.


$firstName = array("Bob", "Bill", "Brad", "Braxton");

$lastName = array("Wallace", "Windsor", "Garfield", "Roosevelt");

function randFirstName()
  global $firstName;
  return $firstName[array_rand($firstName, 1)];

function randLastName()
  global $lastName;
  return $lastName[array_rand($lastName, 1)];


<p><?php echo ucfirst("" . randFirstName() . " " . randLastName() . "" ); ?></p>


I ran into an issue while creating some videos for a WordPress theme this week and needed to delete some pages. The only problem was, I couldn’t access the “Pages” page. To delete the pages, I ended up going into phpMyAdmin and manually deleting them from the database. To find the pesky pages, I wrote the following query:


I then was able to delete the pages and move on with my life.

Friday Inspiration

To inspire you to do something cool this weekend, check out this stop-motion whiteboard animation from kristoferstrom.

Notify of
Inline Feedbacks
View all comments

John Hartley is a Director of Product Engineering at Beam Dental in Columbus, OH. With 5+ years of leadership experience he has worked in startups, agencies, and began his career as a freelance Front End Developer. Always looking to iterate, this blog is a place for him to share his knowledge as well as hone his craft, challenge assumptions, and build a strong base of leadership and management knowledge. Connect with him on LinkedIn

Would love your thoughts, please comment.x