post_type ) { wp_enqueue_script( 'wbcr-inp-admin-scripts', WINP_PLUGIN_URL . '/admin/assets/js/scripts.js', [ 'jquery', 'jquery-ui-tooltip', ], WINP_PLUGIN_VERSION ); } } /** * Asset scripts for the tinymce editor * * @param string $hook */ function wbcr_inp_enqueue_tinymce_assets( $hook ) { $pages = [ 'post.php', 'post-new.php', 'widgets.php', ]; if ( ! in_array( $hook, $pages ) || ! current_user_can( 'edit_posts' ) ) { return; } wp_enqueue_script( 'wbcr-inp-tinymce-button-widget', WINP_PLUGIN_URL . '/admin/assets/js/tinymce4.4.js', [ 'jquery' ], WINP_PLUGIN_VERSION, true ); } add_action( 'admin_enqueue_scripts', 'wbcr_inp_enqueue_tinymce_assets' ); add_action( 'admin_enqueue_scripts', 'wbcr_inp_enqueue_scripts' ); /** * Adds js variable required for shortcodes. * * @since 1.1.0 * @see before_wp_tiny_mce */ function wbcr_inp_tinymce_data( $hook ) { if ( ! current_user_can( 'edit_posts' ) ) { return; } // styles for the plugin shorcodes $shortcode_icon = WINP_PLUGIN_URL . '/admin/assets/img/shortcode-icon5.png'; $shortcode_title = __( 'Woody Code Snippets', 'insert-php' ); $result = WINP_Helper::get_shortcode_data( true ); $shortcode_snippets_json = json_encode( $result ); ?> action || 'post' !== $screen->base || WINP_SNIPPETS_POST_TYPE !== $screen->post_type ) { return; } $winp_item = WINP_HTTP::get( 'winp_item', null ); if ( ! is_null( $winp_item ) ) { return; } $url = admin_url( 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE . '&page=winp-new-item' ); wp_safe_redirect( $url ); exit; } add_action( 'current_screen', 'wbcr_inp_redirect_to_new_item' );