Modifying the Excerpt of a Sermon Archive

“Can I display both audio and video players in the list view?”

“Why is there no audio player for my sermons when they are in a list?”

“How do I remove the date field from the archive view?”

The answer to these questions lies in a little-known feature of WordPress called the excerpt. This is my brief summary of the linked codex article and some helpful notes:

  • Every post type on a WordPress site has an associated archive view (think “list”)
  • The archive view lists all the posts but not in their entirety. The parts of the post that are displayed make up the “excerpt”
  • Sermon Manager creates a custom post type called “sermons” which therefore has its own archive (by default located at www.yourdomain.com/sermons but this location can be changed in the sermon manager settings)
  • The Sermon Manager plugin controls what is included in the archive view “excerpt” by default.

Themes can also customize the excerpt of a custom post type which is how our premium themes like Morgan or Anchor can show off features of Sermon Manager.

Unfortunately we cannot please everybody so there are times when the Sermon Manager default excerpt needs to change. A terrible way to do this is to tweak the Sermon Manager plugin files directly on your site. This is a bad idea because all your changes will be lost the next time we update the plugin. You need a way to customize the plugin safely and permanently.

How to Use a Functionality Plugin to Change the Excerpt

There is a lot more to be said about using a functionality plugin but I will save that for you to read in this tutorial by Eric Dye if you wish later.

Lets get started by creating your blank functionality plugin. I suggest installing this functionality plugin creator on your WordPress site to make it easy. Once installed, all you will notice different is a new menu item under the dashboard > plugins menu called “edit functions.” Click that and you will be taken to the template file awaiting your first function.

Next you add your first custom function which is going to be your new excerpt code. We made this super easy by designing a custom excerpt snippet for you that you can copy and paste directly into the functions.php file. Here is a picture from the plugin editor view of what it should kind of look like in place.

screen

At this point you could click the blue update file button and immediately notice a difference in your sermon archive but it is probably not the difference you wanted. This is where these instructions become more general as what you need to change depends on your situation. We will briefly explain what the provided sample code does and close by giving you some alternatives.

Exploring the Excerpt Code Snippet and What You Can Do With It

You must tinker with the code to make it fit your needs but the sample we created was for the purpose of adding the sermon description to the excerpt view (located almost at the bottom). Here is a screenshot of the code snippet giving you an idea of its parts. My comments are in red. As you can see, the first several lines performs the task of removing the old excerpt and inserting the custom one.

code_options

If you are trying to simplify the excerpt then just removing several of these sections and saving the file will suit your purpose. However, most people want to add elements. Here is the code that displays everything on the single post view–the whole enchilada. Start with this and cut out what you don’t want.

If you are trying to add new parts not listed, you must consult the Sermon Manager template tags KB article to see what tags are available for you to add and then insert them. Remember to save the file and test. Don’t be afraid to experiment to find what you need.

If you need additional assistance with this process, the customer support channels are available to clients of WPforChurch.com. Alternatively, you can search or post your questions on the Sermon Manager community user forum.