After much deliberation and anticipation to get help from a premium theme developer to send me a response to my query, I got frustrated like most of us would be. One starts to think of adding to the product that is not there own baby and also increase on the web developing community. I have to give credit where it is due as the heaven’s corner theme is well build with custom post types especially for the events and sermon posts. The key issue hear for the extra customization I wanted was to add an audio player that would cut across all platforms of web browsers without using
- Increasing the WordPress queries
- Making the website owner have more work
- Add another custom field and code for the website.
Here is what I wanted to create using the information already existing the WordPress database for the website I had developed i.e The Audio/file link in the custom fields to the sermon post type.
We have a few pointers in this project, that’s the old time favourite WordPress codex and voila! No more hustle. Okay here is the real code. Add the development code in the single.php The premium theme already does the calling the different post types. in the first 3 lines of the single.php file. The audio player code that is illustrated in the image is what you need.
I only found one glitch after adding this php code. An error occurs on all you other post types. Since the array field “sermon_download” is not in the other post types apart from the sermon post types. So we need to update with the ‘if’ statement to exclude running this code when it is other post types apart from sermon post types.
We have added a little metre to help you grade yourself for the skill set needed for this job or what skill set you had attained for using the WordPress API and simple php.
You can find the gist on github here