Assign Footer Based on Template

Hi,

Is it possible to assign a footer based on the custom template selected?

Thank you

Hello Tekton,

Thanks for writing in!

By default, you can only assign the custom footer to pages, posts, or in a specific page or post. There is no setting that you can assign it according to the template that is selected for a page.

What you can do is to add this custom php function in your child theme’s functions.php file instead:

add_filter('cs_match_footer_assignment', 'custom_template_footer');
function custom_template_footer($match) {
	if ( is_page_template('template-name.php') ) {
		$match = 1234; // the ID for your header
	}
	return $match;
}

Just make sure that you please the template name and the custom footer ID.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

Hope this helps. Please let us know how it goes.

Thanks for the reply.

I assume the comment that says “the ID for your header” should be “the ID for your footer” right?

How do I find the ID for the footer I want to use?

Hi,

Yes, it should be the id of your footer.

When editing your footer, you can find the id in the url.

eg. http://yoursite.com/pro/#/footers/5/layout

The id of the footer in that url is 5

Thanks

That worked. Thanks.

You’re welcome! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.