Add scripts to wc setup footer

This commit is contained in:
Joshua Flowers 2019-02-28 17:41:15 +08:00
parent 37d3fff3d6
commit 9128e8c4f5
2 changed files with 11 additions and 0 deletions

View File

@ -331,6 +331,7 @@ class WC_Admin_Setup_Wizard {
<?php elseif ( 'recommended' === $this->step || 'activate' === $this->step ) : ?>
<a class="wc-setup-footer-links" href="<?php echo esc_url( $this->get_next_step_link() ); ?>"><?php esc_html_e( 'Skip this step', 'woocommerce' ); ?></a>
<?php endif; ?>
<?php do_action( 'wc_setup_footer' ); ?>
</body>
</html>
<?php

View File

@ -44,12 +44,22 @@ class WC_Admin_Setup_Wizard_Tracking {
return;
}
add_action( 'wc_setup_footer', array( __CLASS__, 'add_footer_scripts' ) );
add_filter( 'woocommerce_setup_wizard_steps', array( __CLASS__, 'set_obw_steps' ) );
add_action( 'shutdown', array( __CLASS__, 'track_skip_step' ), 1 );
add_action( 'add_option_woocommerce_allow_tracking', array( __CLASS__, 'track_start' ), 10, 2 );
self::add_step_save_events();
}
/**
* Add footer scripts to OBW since it does not contain hooks for
* wp_footer to allow the default methods of enqueuing scripts.
*/
public static function add_footer_scripts() {
echo '<script type="text/javascript" src="https://stats.wp.com/w.js?ver=' . gmdate( 'YW' ) . '"></script>'; // @codingStandardsIgnoreLine
wc_print_js();
}
/**
* Track when tracking is opted into and OBW has started.
*