I have just built a new Web site for my Temple, Texas church, and I’m quite proud of it. It’s built on the beautiful Story theme for WordPress.

Problem

We are a young and agile church, and we change things… lots of things… very regularly. I love that we’re able to do this, but it makes keeping a Web site fresh just a bit of a challenge.

One of the things that we change most regularly is our service times. We have a large number of college students who call our church their “church home away from home.” Actually, no one really says that. So, over summer and Christmas break, there is a noticeable difference in attendance. We typically drop a service time during these breaks as a result.

I was joking with our operations guy that we change service times more than dancers change costumes.

Solution

It’s a good idea to have your service times listed many places on your church Web site. On our little Web site, we have them listed on probably a dozen pages. It was always a challenge to remember all those locations when we decided to make a change in times.

So, as we launched our new Web site, I made a painfully simple WordPress plugin to reduce the likelihood that we miss one of these updates.

I’m including the code here, not because it’s awesome or revolutionary. I’m including it because it may get your creative juices flowing, or it may be just the thing that you’ve always wanted but never knew that you wanted.

Vista Service Times

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/*
Plugin Name: Vista Service Times
Description: This plugin will display service times. Just add [vista-service-times] or [vista-service-times type=”list”] or [vista-service-times word=”or”] to a page.
Version: 1.0
Author: Matt Irvine
Author URI: http://www.matthewirvine.com
*/
 
add_shortcode(‘vista-service-times’, ‘vew_vista_service_times’);
 
function vew_vista_service_times( $attributes, $content = null ) {
//Here’s where to set the service times playa
$service_times=array(
  “9am”,
  “10:30am”,
  “12pm”
);
$return=“”;
if ($attributes[‘type’]==“list”) {
$return .= “<ul>\n”;
foreach ($service_times as $service_time) {
$return .= “<li>”.$service_time.“</li>\n”;
}
$return .= “</ul>\n”;
}
else {
if ($attributes[‘word’]==“or”) {
$implodez=” or “;
} else {
$implodez=” and “;
}
if (count($service_times)==2) {
$return=implode($implodez,$service_times);
} else {
$return=join($implodez, array_filter(array_merge(array(join(‘, ‘, array_slice($service_times, 0, 1))), array_slice($service_times, 1))));
}
}
 
return $return;
}
 
?>