Created
June 2, 2023 07:51
-
-
Save MjHead/e27b0938742d2a700335451539901d88 to your computer and use it in GitHub Desktop.
Change template for JetThemeCore plugin based on the option value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'jet-theme-core/location/render/template-id', function( $template_id ) { | |
/** | |
* 123 - is ID of initial template you set in ThemeCore (could be found in adress bar) | |
* 'alternate-value' - is value of option which enables alternative layout for this page | |
* page-slug and option-name - there are option page slug and option name itself which are responsible for layout | |
*/ | |
if ( 123 === $template_id && 'alternate-value' === jet_engine()->listings->data->get_option( 'page-slug::option-name' ) ) { | |
// 321 - is alternative template, coud be anything - elementor templte, themecore template, listing template etc. | |
$template_id = 321; | |
} | |
return $template_id; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment