Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Last active July 25, 2023 07:48
Show Gist options
  • Save xlplugins/f257c3ab4051e76759f3da675e316aff to your computer and use it in GitHub Desktop.
Save xlplugins/f257c3ab4051e76759f3da675e316aff to your computer and use it in GitHub Desktop.
Allow theme scripts for particular step #upsell #funnelkit #theme css
class WF_Allow_Theme_CSS_JS {
private $allow_post_type = [
'wffn_landing',
'wffn_ty',
'wffn_optin',
'wffn_oty',
];
public function __construct() {
add_filter( 'wffn_allowed_themes', [ $this, 'action' ] );
add_action( 'wp', [ $this, 'upsells' ], 11 );
}
public function action( $args ) {
global $post;
if ( ( ! empty( $post ) && in_array( $post->post_type, $this->allow_post_type ) ) ) { // change here particular post type
array_push( $args, get_template() );
return $args;
}
return $args;
}
public function upsells() {
if ( function_exists( 'WFOCU_Core' ) ) {
remove_action( 'wp_enqueue_scripts', array( WFOCU_Core()->assets, 'wfocu_remove_conflicted_themes_styles' ), 9999 );
add_filter('wfocu_allow_externals_on_customizer', '__return_true');
}
}
}
new WF_Allow_Theme_CSS_JS();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment