Custom Sermon Upload Interface

The main content of the sermon custom post type is the link to the MP3 file. When the post is displayed on the main webpage, it also uses an audio player plugin to get a cool flash based player right in the post itself. This is done from the backend with a shortcode. Other than the actual link to the uploaded MP3 file, the content should be identical.

Of course, this is best done by getting rid of the default editor, which leaves plenty of room for user error. I replaced the whole thing with a couple of meta boxes. However, editor support for the post is still needed. The trick is to use CSS to hide the editor interface, not to remove support for it entirely. I’ve explained this in a previous post titled “Hiding the Editor“.

The main interface now consists of just 2 meta boxes, one for the scripture text and the other for file upload. How to create a file upload meta box was explained in my previous post on Newsletter Creation.

All the user has to do now is to fill in all the boxes correctly and check the correct taxonomy items. The save() function from the meta box class will handle all the file processing and automatically generate the correct post content to get the desired output.

Since the same code handles both the sermons and the newsletters for both the English and the Chinese sites, it has to differentiate them all by the filename. Sermons get the audio shortcode and link in the post content, while newsletters are added by attaching them to the post. The theme files will then handle the display of newsletters. Although they can both be done by putting the data in post content, I hadn’t figured out how to hide the editor when I did newsletters, so I had to remove editor support and work around it by using the theme to display the metadata properly. This would have been unlikely to work for the audio plugin which uses a shortcode.

There is now a simple interface for adding both sermons and newsletter post types!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s