1. Documentation /
  2. Make your theme compatible with Homepage Control

Make your theme compatible with Homepage Control

Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

Assuming your theme has a homepage consisting of several components, it can be made compatible with Homepage Control. The only stipulation is that each of those components must be called via function that is hooked into a homepage action in your index.php (or front-page.php/home.php). Here’s a quick guide:

In our themes we have the following code in index.php:
if ( is_home() ) {
				do_action( 'homepage' );
			} else {
				get_template_part( 'loop' );
			}
Here we check if the current page is the homepage before executing the homepage action. If it’s not the homepage (WordPress uses index.php as a fallback to display archives when the appropriate template file doesn’t exist in the theme) we display the loop. Elsewhere in the theme we hook functions into that homepage action, e.g:
add_action( 'homepage', 'woo_slider', 10 );
That woo_slider() function might look like this:
function woo_slider() {
	get_template_part( 'slider' );
}
Homepage Control automatically recognizes the function has been hooked in and will display it as an item in the setting screen of the plugin. It’s as simple as that!