wp_enqueue_script example



        if ( use_block_editor_for_post( $post ) ) {
            require ABSPATH . 'wp-admin/edit-form-blocks.php';
            break;
        }

        if ( ! wp_check_post_lock( $post->ID ) ) {
            $active_post_lock = wp_set_post_lock( $post->ID );

            if ( 'attachment' !== $post_type ) {
                wp_enqueue_script( 'autosave' );
            }
        }

        $post = get_post( $post_id, OBJECT, 'edit' );

        if ( post_type_supports( $post_type, 'comments' ) ) {
            wp_enqueue_script( 'admin-comments' );
            enqueue_comment_hotkeys_js();
        }

        require ABSPATH . 'wp-admin/edit-form-advanced.php';

        
$avatar = get_avatar( get_comment(), 32, 'mystery' );
    return "$avatar $name";
}

/** * Enqueues comment shortcuts jQuery script. * * @since 2.7.0 */
function enqueue_comment_hotkeys_js() {
    if ( 'true' === get_user_option( 'comment_shortcuts' ) ) {
        wp_enqueue_script( 'jquery-table-hotkeys' );
    }
}

/** * Displays error message at bottom of comments. * * @param string $msg Error Message. Assumed to contain HTML and be sanitized. */
function comment_footer_die( $msg ) {
    echo "<div class='wrap'><p>$msg</p></div>";
    require_once ABSPATH . 'wp-admin/admin-footer.php';
    

}

$post    = get_default_post_to_edit( $post_type, true );
$post_ID = $post->ID;

/** This filter is documented in wp-admin/post.php */
if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
    if ( use_block_editor_for_post( $post ) ) {
        require ABSPATH . 'wp-admin/edit-form-blocks.php';
    } else {
        wp_enqueue_script( 'autosave' );
        require ABSPATH . 'wp-admin/edit-form-advanced.php';
    }
} else {
    // Flag that we're not loading the block editor.     $current_screen = get_current_screen();
    $current_screen->is_block_editor( false );
}

require_once ABSPATH . 'wp-admin/admin-footer.php';
case 'delete':
        $link_id = (int) $_GET['link_id'];
        check_admin_referer( 'delete-bookmark_' . $link_id );

        wp_delete_link( $link_id );

        wp_redirect( $this_file );
        exit;

    case 'edit':
        wp_enqueue_script( 'link' );
        wp_enqueue_script( 'xfn' );

        if ( wp_is_mobile() ) {
            wp_enqueue_script( 'jquery-touch-punch' );
        }

        $parent_file  = 'link-manager.php';
        $submenu_file = 'link-manager.php';
        // Used in the HTML title tag.         $title = __( 'Edit Link' );

        

function wp_maybe_enqueue_oembed_host_js( $html ) {
    if (
        has_action( 'wp_head', 'wp_oembed_add_host_js' )
        &&
        preg_match( '/<blockquote\s[^>]*?wp-embedded-content/', $html )
    ) {
        wp_enqueue_script( 'wp-embed' );
    }
    return $html;
}

/** * Retrieves the URL to embed a specific post in an iframe. * * @since 4.4.0 * * @param int|WP_Post $post Optional. Post ID or object. Defaults to the current post. * @return string|false The post embed URL on success, false if the post doesn't exist. */
wp_add_inline_script(
    'wp-blocks',
    'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
);

wp_add_inline_script(
    'wp-blocks',
    sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( isset( $editor_settings['blockCategories'] ) ? $editor_settings['blockCategories'] : array() ) ),
    'after'
);

wp_enqueue_script( 'wp-edit-site' );
wp_enqueue_script( 'wp-format-library' );
wp_enqueue_style( 'wp-edit-site' );
wp_enqueue_style( 'wp-format-library' );
wp_enqueue_media();

if (
    current_theme_supports( 'wp-block-styles' ) &&
    ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 )
) {
    wp_enqueue_style( 'wp-block-library-theme' );
}

$parent_file  = 'sites.php';
$submenu_file = 'sites.php';

/** * Filters whether to show the Add Existing User form on the Multisite Users screen. * * @since 3.1.0 * * @param bool $bool Whether to show the Add Existing User form. Default true. */
if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) {
    wp_enqueue_script( 'user-suggest' );
}

require_once ABSPATH . 'wp-admin/admin-header.php';
?> <script type="text/javascript"> var current_site_id = <?php echo absint( $id ); ?>; </script> <div class="wrap"> <h1 id="edit-site">
?> #page { background: url("<?php bloginfo( 'stylesheet_directory' ); ?>/images/kubrickbg-<?php bloginfo( 'text_direction' ); ?>.jpg") repeat-y top; border: none; } <?php } else { // No sidebar. ?> #page { background: url("<?php bloginfo( 'stylesheet_directory' ); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } <?php } ?> </style> <?php } ?> <?php if ( is_singular() ) {
    wp_enqueue_script( 'comment-reply' );
}
?> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <div id="page"> <div id="header" role="banner"> <div id="headerimg"> <h1><a href="<?php echo home_url(); ?>/"><?php bloginfo( 'name' ); ?></a></h1> <div class="description">
$sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' )$sendback );

    wp_redirect( $sendback );
    exit;
} elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
    wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' )wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    exit;
}

$wp_list_table->prepare_items();

wp_enqueue_script( 'inline-edit-post' );
wp_enqueue_script( 'heartbeat' );

if ( 'wp_block' === $post_type ) {
    wp_enqueue_script( 'wp-list-reusable-blocks' );
    wp_enqueue_style( 'wp-list-reusable-blocks' );
}

// Used in the HTML title tag. $title = $post_type_object->labels->name;

if ( 'post' === $post_type ) {
    
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    '<p>' . __( '<a href="https://wordpress.org/documentation/article/tools-erase-personal-data-screen/">Documentation on Erase Personal Data</a>' ) . '</p>' .
    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
);

// Handle list table actions. _wp_personal_data_handle_actions();

// Cleans up failed and expired requests before displaying the list table. _wp_personal_data_cleanup_requests();

wp_enqueue_script( 'privacy-tools' );

add_screen_option(
    'per_page',
    array(
        'default' => 20,
        'option'  => 'remove_personal_data_requests_per_page',
    )
);

$_list_table_args = array(
    'plural'   => 'privacy_requests',
    
'<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' .
                    '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>',
            )
        );

        get_current_screen()->set_help_sidebar(
            '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
            '<p>' . __( '<a href="https://wordpress.org/documentation/article/comments-screen/">Documentation on Comments</a>' ) . '</p>' .
            '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
        );

        wp_enqueue_script( 'comment' );
        require_once ABSPATH . 'wp-admin/admin-header.php';

        if ( ! $comment ) {
            comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'javascript:history.go(-1)' ) );
        }

        if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
            comment_footer_die( __( 'Sorry, you are not allowed to edit this comment.' ) );
        }

        if ( 'trash' === $comment->comment_approved ) {
            


/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'upload_files' ) ) {
    wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
}

wp_enqueue_script( 'plupload-handlers' );

$post_id = 0;
if ( isset( $_REQUEST['post_id'] ) ) {
    $post_id = absint( $_REQUEST['post_id'] );
    if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
        $post_id = 0;
    }
}

if ( $_POST ) {
    if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) {
        
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );

        if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) {
            return;
        }

        $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
        $url     = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) );
        $label   = __( 'View Privacy Policy Guide.' );

        if ( get_current_screen()->is_block_editor() ) {
            wp_enqueue_script( 'wp-notices' );
            $action = array(
                'url'   => $url,
                'label' => $label,
            );
            wp_add_inline_script(
                'wp-notices',
                sprintf(
                    'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
                    $message,
                    wp_json_encode( $action )
                ),
                

    public function enqueue_preview_scripts() {
        /** This filter is documented in wp-includes/media.php */
        if ( 'mediaelement' === apply_filters( 'wp_video_shortcode_library', 'mediaelement' ) ) {
            wp_enqueue_style( 'wp-mediaelement' );
            wp_enqueue_script( 'mediaelement-vimeo' );
            wp_enqueue_script( 'wp-mediaelement' );
        }
    }

    /** * Loads the required scripts and styles for the widget control. * * @since 4.8.0 */
    public function enqueue_admin_scripts() {
        parent::enqueue_admin_scripts();

        


    wp_safe_redirect( $redirect_to );
    exit;
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' )wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    exit;
}

$wp_list_table->prepare_items();

wp_enqueue_script( 'admin-comments' );
enqueue_comment_hotkeys_js();

/** * @global int $post_id */
global $post_id;

if ( $post_id ) {
    $comments_count      = wp_count_comments( $post_id );
    $draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' );

    
Home | Imprint | This part of the site doesn't use cookies.