Customize Archive & Single Sermon 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 how 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.
1. Utilizing Hooks #
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("");
}
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/
2. Customized Templates #
To customize the templates, you will need to override the default templates provided by the plugin. This is done by creating a specific subfolder in your child theme and adding your custom template files there.
1. Create a Subfolder in Your Child Theme:
Navigate to your child theme directory and create a new subfolder named /advanced-sermons/. This subfolder will be recognized by the Advanced Sermons plugin and will be used to look for custom template files.
2. Add Custom Template Files:
Within the /advanced-sermons/ subfolder, you can create the following files to override the default templates:
Single Sermon Template:
Create a file named sermon-single.php. This file will be used to display individual sermon pages. You can customize this template to change how each sermon is presented on its own page.
Sermon Archive Template:
Create a file named archive-sermons.php. This file will control the layout and design of the sermon archive pages, where multiple sermons are listed.
3. Tips for Customizing Templates
Use the Default Templates as a Starting Point: You can find the default template files within the plugin’s directory. These files can serve as a good starting point for your customizations. Copy the content from these files into your custom templates and modify as needed.
Maintain WordPress Standards: When customizing your templates, ensure that they adhere to WordPress coding standards and best practices. This will help in maintaining the compatibility and performance of your website.
Test Your Changes: After making changes to your templates, thoroughly test your website to ensure that the sermons are displayed correctly and that there are no layout or functionality issues.
Update Safely: Remember that your custom templates are in your child theme, so they won’t be overwritten when you update the main theme or the Advanced Sermons plugin.
By following these steps, you can create custom templates for your sermons, providing a unique and tailored experience for your website visitors.