本文整理汇总了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’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;未经允许,请勿转载。 |
请发表评论