Customize Sermon Archive Template

Customize Sermon Archive Template #

Introduction

Today we are going to show you how to customize the sermon archive template using the built-in hooks available in Advanced Sermons. For this documentation we are going to show you have to include an Elementor Template, WP Bakery, and Shortcodes. These are just a few examples, with hooks you can customize Advanced Sermons to meet your needs.

Hooks

Hooks give you or your developer the ability to customize Advanced Sermons further. Everything from adding custom metabox fields, more filter sermon options, and new sections on the single sermon template. You can view a list of all available hooks here: https://advancedsermons.com/docs/hooks/

Placement

This code should be placed in the functions.php file of your active theme or a custom plugin. This allows you to update Advanced Sermons without loosing any of your custom modifications.

Since

Hooks were introduced in Advanced Sermons 1.5 and Advanced Sermons Pro 1.1.


1. Suggested Hooks

<!-- Action hook to add custom content outside the container at the very TOP of archive sermons -->
add_action( 'asp_hook_archive_top_holder', 'your_function_name' );

<!-- Action hook to add custom content outside the container at the very BOTTOM of archive sermons -->
add_action( 'asp_hook_archive_bottom_holder', 'your_function_name' );


2. Shortcodes

Lets say you want to include a Slider Revolution slider on the top of the sermon archive template. You can use the ‘asp_hook_sermon_single_top’ hook to add the slider revolution shortcode to the sermon archive template:

<!-- Add slider revolution to sermon archive top -->
add_action( 'asp_hook_archive_top_holder', 'asp_custom_archive_template' );
function asp_custom_archive_template() {
     echo do_shortcode("[rev_slider_shortcode_here]");
}


3. Page Builders

If you’re using a page builder for your WordPress website, you can use the shortcodes provided by your page builder to display templates or content on the sermon archive page.

<!-- Add Elementor template to sermon archive top -->
add_action( 'asp_hook_archive_top_holder', 'asp_custom_archive_template' );
function asp_custom_archive_template() {
     echo do_shortcode("[elementor-template id='TEMPLATE ID HERE']");
}

WP Bakery is a little more tricky in the fact that they do not have a shortcode to display a template built directly into their plugin, however, you have a few different options to display your WP Bakery templates or content.

Your first option is you can create a new draft page and design your template for the top or bottom of the archive page. Once you’re done, click the text tab in the content editor and copy the shortcodes created by WP Bakery. You can then paste those shortcodes in the code snippet below:

<!-- Add WP Bakery content to sermon archive top -->
add_action( 'asp_hook_archive_top_holder', 'asp_custom_archive_template' );
function asp_custom_archive_template() {
     echo do_shortcode("[Paste WP Bakery shortcodes here]");
}

WP Bakery has an addon called Templatera that expands the functionality of WP Bakery’s template that allows you to broadcast templates across your website with their built in shortcode. You can learn more about Templatera here: https://wpbakery.com/addons/templatera/