true, 'strategy' => 'defer', ) ); wp_set_script_translations( 'start-stackable-frontend', 'start-stackable', get_theme_file_path( 'languages' ) ); } } } add_action( 'wp_enqueue_scripts', 'start_stackable_enqueue_assets' ); if ( ! function_exists( 'start_stackable_body_class' ) ) { /** * Shell contract: identify this theme for the companion plugin. * * @param string[] $classes Body classes. * @return string[] */ function start_stackable_body_class( $classes ) { $classes[] = 'stk--is-stackable-theme'; return $classes; } } add_filter( 'body_class', 'start_stackable_body_class' ); if ( ! function_exists( 'start_stackable_is_stackable_active' ) ) { /** * Check whether the companion Stackable plugin is active. * * Active plugins load before the theme, so Stackable's version constant is * available by the time this file runs. * * @return bool */ function start_stackable_is_stackable_active() { return defined( 'STACKABLE_VERSION' ); } } if ( ! function_exists( 'start_stackable_should_show_plugin_notice' ) ) { /** * Check whether the current user should see the Stackable recommendation. * * @return bool */ function start_stackable_should_show_plugin_notice() { return current_user_can( 'install_plugins' ) && ! start_stackable_is_stackable_active() && ! get_user_meta( get_current_user_id(), 'start_stackable_dismiss_plugin_notice', true ); } } if ( ! function_exists( 'start_stackable_get_stackable_plugin_file' ) ) { /** * Find the installed Stackable plugin entry point. * * @return string */ function start_stackable_get_stackable_plugin_file() { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } foreach ( array_keys( get_plugins() ) as $plugin_file ) { if ( 0 === strpos( $plugin_file, 'stackable-ultimate-gutenberg-blocks/' ) ) { return $plugin_file; } } return ''; } } if ( ! function_exists( 'start_stackable_plugin_notice' ) ) { /** * Recommend the optional Stackable plugin. */ function start_stackable_plugin_notice() { if ( ! start_stackable_should_show_plugin_notice() ) { return; } $plugin_slug = 'stackable-ultimate-gutenberg-blocks'; $plugin_file = start_stackable_get_stackable_plugin_file(); if ( $plugin_file ) { $plugin_url = wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => $plugin_file, ), self_admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ); $button_label = __( 'Activate Stackable', 'start-stackable' ); } else { $plugin_url = add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => $plugin_slug, ), self_admin_url( 'plugin-install.php' ) ); $button_label = __( 'Install Stackable', 'start-stackable' ); } ?>