• Resolved Rene

    (@renehamburger)


    When displaying a single sermon, the sermon details (i.e. date, event, Bible passage, speaker, series etc.) are displayed as HTML and look great. But when the sermon is displayed as part of a text search on the site or as part of a specific event/speaker/series etc., the excerpt is just a text-version of the html content above saved in the post, which is highly unreadable as you can imaging, with missing spaces and an ‘Download FilesMP3’ without a link. I assume, this is just the default way of WordPress to generate an excerpt from a post’s html content.

    I was hoping to change this by implementing the custom excerpt function described at https://wpforchurch.com/my/knowledgebase/69/Modifying-the-Excerpt-of-a-Sermon-Archive.html. But this function (as well as the one it replaces) does not seem to be called in any of the instances above. The only time it gets called is for “[sermons]” shortcode.

    Would it be possible to force WordPress to keep the HTML as it is when creating the excerpt or add another hook to handle this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Rene

    (@renehamburger)

    I’ve found a way to customise the display for sermon lists for a specific taxonomy-term by adding a template partial partials/entry/layout-wpfc_sermon.php to my child theme to handle the display of the the wpfc_sermon post type.

    For searches, another more generic template is used (partials/search/layout.php), which I decided not to overwrite for now.

    In any case, the much better solution would be for your plugin to save a readable text-only (or minimal-html) post_excerpt as well as the html post_content when a sermon is created or updated. Ideally, you could add a filter to allow the users of your plugin to customise this excerpt.

    Would that be something you would consider?

    Hi @renehamburger,

    Thank you for your suggestion.

    We have modified the code to create a properly rendered plain text output for WordPress database saving – you will see that it’s much better now.

    It will save the following to the post_content field:

    Bible Text: <passage> | Preacher: <preacher name(s)> | Series: <series name(s)>
    
    <full sermon description, striped from any HTML tags>
    

    And it will save the shortened output to the post_excerpt field. (it will be passed through wp_trim_excerpt() function, and shortened to 55 words, by default.)

    If you want to modify the content that will be saved to the database, you can do so with following filters:

    • sm_sermon_post_content for post_content (append underscore and sermon ID to the end of filter name for filtering specific sermon)
    • sm_sermon_post_excerpt for post_excerpt (same applies as for content)

    To use all those modifications, please do the following:

    1. Deactivate and remove the existing Sermon Manager
    2. Download and activate the development version

    Note: No data will be lost and you will receive future updates automatically.

    Also, to update all excerpts and contents of existing sermons, before the release, please go to Sermon Manager Settings -> Debug tab and under Execute a specific update function dropdown, and please select the last function, which will be called sm_update_211_render_content.

    Thank you for your patience so far, and let us know if you have any other suggestions. ??

    Nikola Miljkovi?
    Lead Developer @ WP For Church

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sermon excerpts largely unreadable’ is closed to new replies.