當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_edit_attachments_query_vars函數代碼示例

本文整理匯總了PHP中wp_edit_attachments_query_vars函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_edit_attachments_query_vars函數的具體用法?PHP wp_edit_attachments_query_vars怎麽用?PHP wp_edit_attachments_query_vars使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_edit_attachments_query_vars函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wp_edit_attachments_query

/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|false $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    wp(wp_edit_attachments_query_vars($q));
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    return array($post_mime_types, $avail_post_mime_types);
}
開發者ID:nicholasgriffintn,項目名稱:WordPress,代碼行數:16,代碼來源:post.php

示例2: wp_die

    wp_die(__('You do not have permission to upload files.'));
}
$mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
$modes = array('grid', 'list');
if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) {
    $mode = $_GET['mode'];
    update_user_option(get_current_user_id(), 'media_library_mode', $mode);
}
if ('grid' === $mode) {
    wp_enqueue_media();
    wp_enqueue_script('media-grid');
    wp_enqueue_script('media');
    $q = $_GET;
    // let JS handle this
    unset($q['s']);
    $vars = wp_edit_attachments_query_vars($q);
    $ignore = array('mode', 'post_type', 'post_status', 'posts_per_page');
    foreach ($vars as $key => $value) {
        if (!$value || in_array($key, $ignore)) {
            unset($vars[$key]);
        }
    }
    wp_localize_script('media-grid', '_wpMediaGridSettings', array('adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH), 'queryVars' => (object) $vars));
    get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.') . '</p>' . '<p>' . __('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.') . '</p>' . '<p>' . __('To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.') . '</p>'));
    get_current_screen()->add_help_tab(array('id' => 'attachment-details', 'title' => __('Attachment Details'), 'content' => '<p>' . __('Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.') . '</p>' . '<p>' . __('Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.') . '</p>' . '<p>' . __('You can also delete individual items and access the extended edit screen from the details dialog.') . '</p>'));
    get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
    $title = __('Media Library');
    $parent_file = 'upload.php';
    require_once ABSPATH . 'wp-admin/admin-header.php';
    ?>
	<div class="wrap" id="wp-media-grid" data-search="<?php 
開發者ID:nstungxd,項目名稱:F2CA5,代碼行數:31,代碼來源:upload.php


注:本文中的wp_edit_attachments_query_vars函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。