Custom WordPress Development
Sweet Me Creamery
A custom WordPress website with a little personality, a lot of ice cream and a content management system that makes it all work.
Sweet Me Creamery was one of those projects where the design was just as interesting as the development. I was responsible for bringing the original designs to life on the web.
I built a custom WordPress theme using Bones as a starting point, with PHP, SCSS, JavaScript and Advanced Custom Fields. The goal was to give the content team control over the website without making them worry about how it was built.
Rather than creating individual pages for every flavor, I built a dedicated content structure that allowed the same product information to be used throughout the site.
And, of course, it all needed to work on mobile.
A different flavor with every visit.
Why settle for one color scheme when you have four?
One of my favorite little details about this website was that the colors could change every time you loaded a page. I built the theme to select from four color variations, giving the site a slightly different personality without changing its layout or content.
- Green
- Orange
- Pink
- Yellow
CONTENT MANAGEMENT
Pretty on the outside. Structured on the inside.
I didn't want adding a new ice cream flavor to mean building another page. That's what templates are for.
Each flavor had its own structured content, including packaging, scoop imagery, descriptions, nutrition and ingredients. WordPress could then use that information wherever it was needed, whether that was the homepage, the product catalog or an individual flavor page.
- Shared content model
Ice Cream custom post type
- Advanced Custom Fields: product imagery, descriptions, nutrition and ingredients
- Custom PHP templates and WordPress queries present the same content in three places.
- Homepage
Product lineup
- The homepage pulls flavor entries and their package images.
- Catalog
Flavor archive
- WordPress lists flavor posts together in a catalog.
- Product detail
Individual flavor pages
- A single PHP template displays each flavor's images
- description and nutrition.
One template. Two flavors.
Different ice cream, same underlying code. The content changes based on the flavor, and the layout adapts based on the screen size.
The desktop layout placed scoop and package imagery side by side.
View full sizeThe mobile layout placed the scoop below the package and rotated it 90 degrees.
View full sizeDESIGN COLLABORATION
From design to development.
I had some really fun designs to work with. The geometric patterns, oversized imagery and unconventional layouts made this a particularly interesting responsive development project.
My job was to figure out how to make it all work in a browser while staying true to the original creative and keeping the content manageable behind the scenes.
Original design comps. The product grid comps use finalized packaging assets substituted for presentation.
Product detail


Product grid


THE IMPLEMENTATION
Because nobody should have to edit PHP to add a flavor.
For anyone curious about what's happening behind all those ice cream photos, here are a few pieces of the original theme.
These excerpts are from recovered project source. I couldn't verify the exact revision that was deployed.
Give ice cream its own content type.
The theme registers a public Ice Cream post type with its own archive and rewrite slug.
From library/custom-post-type.php. Editor labels, registration options and taxonomy associations were shortened. Formatting was normalized and the text domain was renamed to customtheme.
<?php
function custom_post_example() {
register_post_type( 'ice_cream',
array( 'labels' => array(
'name' => __( 'Ice Cream', 'customtheme' ),
'singular_name' => __( 'Ice Cream', 'customtheme' ),
'all_items' => __( 'All Ice Cream Products', 'customtheme' ),
// Other editor labels omitted.
),
'public' => true,
'publicly_queryable' => true,
// Other post type options omitted.
'rewrite' => array( 'slug' => 'ice_cream', 'with_front' => false ),
'has_archive' => 'ice_cream',
)
);
// Category and tag association omitted.
}
add_action( 'init', 'custom_post_example');Separate the content from the presentation.
The product template reads imagery, a heading and a description from ACF and renders each field when it has content.
From single-ice_cream.php. The surrounding layout and other fields were omitted. Formatting was normalized.
<?php
$image = get_field('package_image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" class="pint"/>
<?php endif; ?>
<!-- Headline -->
<?php if( get_field('ice_cream') ): ?>
<h2>
<?php the_field('ice_cream'); ?>
</h2>
<?php endif; ?>
<div class="diamond-divider"></div>
<!-- Description -->
<?php if( get_field('description') ): ?>
<?php the_field('description'); ?>
<?php endif; ?>There's always another flavor.
WordPress uses the adjacent product when one exists. At either end, a query in the opposite sort direction links back around to the other end of the catalog.
From single-ice_cream.php. The two navigation branches are shown together with their surrounding markup omitted.
<?php
if( get_adjacent_post(false, '', true) ) {
previous_post_link('%link', '<span>PREV</span>');
} else {
$first = new WP_Query('posts_per_page=1&order=DESC&post_type=ice_cream'); $first->the_post();
echo '<a href="' . get_permalink() . '"><span>PREV</span></a>';
wp_reset_query();
};
// Surrounding template markup omitted.
if( get_adjacent_post(false, '', false) ) {
next_post_link('%link', '<span>next</span>');
} else {
$last = new WP_Query('posts_per_page=1&order=ASC&post_type=ice_cream'); $last->the_post();
echo '<a href="' . get_permalink() . '"><span>NEXT</span></a>';
wp_reset_query();
};Let the content team manage the content.
An outer ACF repeater organizes location groups, and a nested repeater supplies each group’s store entries.
From page-locations.php. The outer page loop was omitted and whitespace was normalized. This is the grouped list implementation.
<?php
// check for rows (parent repeater)
if( have_rows('location_group') ): ?>
<div id="store_locations">
<?php
// loop through rows (parent repeater)
while( have_rows('location_group') ): the_row(); ?>
<div class="location" style="overflow:auto;">
<div class="title-text-wrap">
<h2><?php the_sub_field('location'); ?></h2>
</div>
<?php
// check for rows (sub repeater)
if( have_rows('store_list') ): ?>
<div class="store_list">
<?php
// loop through rows (sub repeater)
while( have_rows('store_list') ): the_row();
// display each item as a list - with a class of completed ( if completed )
?>
<div class="m-all t-1of2 d-1of3 <?php the_sub_field('css_tag'); ?>"><?php the_sub_field('store'); ?></div>
<?php endwhile; ?>
</div>
<?php endif; //if( get_sub_field('items') ): ?>
</div>
<?php endwhile; // while( has_sub_field('to-do_lists') ): ?>
</div>
<?php endif; // if( get_field('to-do_lists') ): ?>A little variety never hurt anyone.
On document ready, jQuery picks one of four body classes with equal probability. Each page chooses independently, so consecutive loads can pick the same theme. SCSS uses the body class to swap the SVG artwork for each geometric tile.
Paired excerpts from header.php and library/scss/breakpoints/_base.scss. The SCSS is shown in a style block for display. Other tile rules were omitted, and whitespace was normalized. The swatches use fills from the referenced SVG tile assets.
<script type="text/javascript">
jQuery(document).ready(function($) {
var classes = ['green','orange', 'pink', 'yellow']; //add as many classes as u want
var randomnumber = Math.floor(Math.random()*classes.length);
$('body').addClass(classes[randomnumber]);
}); /* end of as page load scripts */
</script>
<style>
.green .sq-r1-3 { background-image: $svg-dk-green;}
.pink .sq-r1-3 { background-image: $svg-dk-pink;}
.orange .sq-r1-3 { background-image: $svg-dk-orange;}
.yellow .sq-r1-3{ background-image: $svg-dk-yellow;}
</style>A little trip back in time. The website screenshots were captured in 2020, and the Wayback Machine has an archived version from July 2019.
View archived website


