RSS feed for this section

Archive | Code Snippets

MAMP, Virtual Hosts and WordPress

Another post in my (seemingly) never ending quest to set up a local development environment. Setup Your local hosts File From Terminal (or iTerm for a much cooler experience), type sudo nano /etc/hosts and enter your password when prompted. At the bottom, add the following two lines.

Save the file (ctrl/cmd + o) and [...]

How to Use MySql Command Line with MAMP

You think you’re gonna just start up iTerm and type ‘mysql`, right?  So did I…

oops….ok, at least I knew enough to think it probably had something to do with MAMP. Google to the rescue! Type this *every* time you want to access MySql using command line when you have MAMP installed.

You [...]

Create a Dropdown Menu for Your Categories In WordPress

 

Display an Enclosure in an RSS Feed

This code snippet displays the first enclosure in an rss feed.

Remove the Dashboard Widgets in WordPress

 

Display the Caption For A Featured Image

Use this code to display the caption for your featured image. <?php add_theme_support( ‘post-thumbnails’ ); /** Add new image sizes **/ add_image_size(‘featured’, 300, 200, TRUE); add_filter ( ‘genesis_after_post_title’, ‘featured_image’ ); function featured_image () { echo ‘<div class=”featured-image”>’; the_post_thumbnail(); echo ‘<span class=”caption”>’ . get_post( get_post_thumbnail_id() )->post_excerpt . ‘</span>’; echo ‘</div>’;} Related articles 15+ Valuable Code Snippets [...]

Genesis Custom Layouts

Love Genesis but don’t love the lack of creative layouts? Try this: Unregister the default layouts and create your own options. This option replaces the loop with a thumbnail and excerpt of three children pages. Better yet, there’s only 2 steps. Register the layout & Use it in your theme Register the Layout /** * [...]