Last active
November 15, 2024 13:56
-
-
Save xlplugins/f257c3ab4051e76759f3da675e316aff to your computer and use it in GitHub Desktop.
(Now we have setting for this) Allow theme scripts for particular step #upsell #funnelkit #theme css
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
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