本文整理汇总了PHP中get_available_post_statuses函数的典型用法代码示例。如果您正苦于以下问题:PHP get_available_post_statuses函数的具体用法?PHP get_available_post_statuses怎么用?PHP get_available_post_statuses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_available_post_statuses函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: status_menu
public function status_menu($post_stati)
{
global $parent_file, $submenu, $submenu_file;
$num_posts = wp_count_posts('page', 'readable');
$num_total = array_sum((array) $num_posts);
$link = $submenu_file = 'edit-pages.php';
$submenu[$parent_file] = array(array(__('Add New Page'), 'edit_pages', 'page-new.php'), array(sprintf(__('All (%s)', 'ktai_style'), $num_total), 'edit_pages', $link));
$post_status_label = __('Pages');
$avail_post_stati = get_available_post_statuses('page');
foreach ($post_stati as $status => $label) {
if (!in_array($status, $avail_post_stati)) {
continue;
}
if (empty($num_posts->{$status})) {
continue;
}
$link = add_query_arg('post_status', $status, $link);
$submenu[$parent_file][] = array(sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->{$status}, 'ktai_style'), number_format_i18n($num_posts->{$status})), 'edit_pages', $link);
if (str_replace('all', '', $status) == $_GET['post_status']) {
$submenu_file = $link;
$post_status_label = $label[1];
$num_total = $num_posts->{$status};
}
}
return array($post_status_label, $num_total);
}
示例2: wp_edit_posts_query
private function wp_edit_posts_query($post_type = null, $q = false)
{
if (false === $q) {
$q = $_GET;
}
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
$post_stati = get_post_stati();
if (empty($post_type)) {
if (isset($q['post_type']) && in_array($q['post_type'], get_post_types())) {
$post_type = $q['post_type'];
} else {
$post_type = 'post';
}
}
$avail_post_stati = get_available_post_statuses($post_type);
if (isset($q['post_status']) && in_array($q['post_status'], $post_stati)) {
$post_status = $q['post_status'];
$perm = 'readable';
}
if (isset($q['orderby'])) {
$orderby = $q['orderby'];
} elseif (isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft'))) {
$orderby = 'modified';
}
if (isset($q['order'])) {
$order = $q['order'];
} elseif (isset($q['post_status']) && 'pending' == $q['post_status']) {
$order = 'ASC';
}
$per_page = 'tm_per_page';
$posts_per_page = (int) get_user_option($per_page);
if (empty($posts_per_page) || $posts_per_page < 1) {
$posts_per_page = 20;
}
$posts_per_page = apply_filters($per_page, $posts_per_page);
$query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
// Hierarchical types require special args.
if (is_post_type_hierarchical($post_type) && !isset($orderby)) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;
$query['posts_per_archive_page'] = -1;
}
// WPML (add meta data to query)
TM_EPO_WPML()->apply_query_filter();
wp($query);
TM_EPO_WPML()->remove_query_filter();
return $avail_post_stati;
}
示例3: prepare_items
function prepare_items()
{
global $post_type_object, $avail_post_stati, $wp_query, $per_page, $mode;
$query_args = array('post_type' => $this->post_type);
$query_args['post_parent'] = $this->post_parent ? $this->post_parent : 0;
$query_args['m'] = isset($_GET['m']) ? (int) $_GET['m'] : 0;
$query_args['cat'] = isset($_GET['cat']) ? (int) $_GET['cat'] : 0;
$wp_query = new WP_Query(apply_filters('cpm_table_query', $query_args));
//$avail_post_stati = wp_edit_posts_query( $query_args );
$avail_post_stati = get_available_post_statuses($this->post_type);
$this->hierarchical_display = $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'];
$total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
$post_type = $post_type_object->name;
$per_page = $this->get_items_per_page('edit_' . $post_type . '_per_page');
$per_page = apply_filters('edit_posts_per_page', $per_page, $post_type);
if ($this->hierarchical_display) {
$total_pages = ceil($total_items / $per_page);
} else {
$total_pages = $wp_query->max_num_pages;
}
$mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
$this->is_trash = isset($_REQUEST['post_status']) && $_REQUEST['post_status'] == 'trash';
$this->set_pagination_args(array('total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page));
}
示例4: _e
echo $this->get_field_id('post_status');
?>
">
<?php
_e('Post Status', 'rpwe');
?>
</label>
<select class="widefat" id="<?php
echo $this->get_field_id('post_status');
?>
" name="<?php
echo $this->get_field_name('post_status');
?>
" style="width:100%;">
<?php
foreach (get_available_post_statuses() as $status_value => $status_label) {
?>
<option value="<?php
echo esc_attr($status_label);
?>
" <?php
selected($instance['post_status'], $status_label);
?>
><?php
echo esc_html(ucfirst($status_label));
?>
</option>
<?php
}
?>
</select>
示例5: wp_edit_posts_query
/**
* Run the wp query to fetch the posts for listing on the edit posts page
*
* @since 2.5.0
*
* @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
* @return array
*/
function wp_edit_posts_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
$post_stati = get_post_stati();
if (isset($q['post_type']) && in_array($q['post_type'], get_post_types())) {
$post_type = $q['post_type'];
} else {
$post_type = 'post';
}
$avail_post_stati = get_available_post_statuses($post_type);
if (isset($q['post_status']) && in_array($q['post_status'], $post_stati)) {
$post_status = $q['post_status'];
$perm = 'readable';
}
if (isset($q['orderby'])) {
$orderby = $q['orderby'];
} elseif (isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft'))) {
$orderby = 'modified';
}
if (isset($q['order'])) {
$order = $q['order'];
} elseif (isset($q['post_status']) && 'pending' == $q['post_status']) {
$order = 'ASC';
}
$per_page = "edit_{$post_type}_per_page";
$posts_per_page = (int) get_user_option($per_page);
if (empty($posts_per_page) || $posts_per_page < 1) {
$posts_per_page = 20;
}
/**
* Filters the number of items per page to show for a specific 'per_page' type.
*
* The dynamic portion of the hook name, `$post_type`, refers to the post type.
*
* Some examples of filter hooks generated here include: 'edit_attachment_per_page',
* 'edit_post_per_page', 'edit_page_per_page', etc.
*
* @since 3.0.0
*
* @param int $posts_per_page Number of posts to display per page for the given post
* type. Default 20.
*/
$posts_per_page = apply_filters("edit_{$post_type}_per_page", $posts_per_page);
/**
* Filters the number of posts displayed per page when specifically listing "posts".
*
* @since 2.8.0
*
* @param int $posts_per_page Number of posts to be displayed. Default 20.
* @param string $post_type The post type.
*/
$posts_per_page = apply_filters('edit_posts_per_page', $posts_per_page, $post_type);
$query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
// Hierarchical types require special args.
if (is_post_type_hierarchical($post_type) && !isset($orderby)) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;
$query['posts_per_archive_page'] = -1;
$query['fields'] = 'id=>parent';
}
if (!empty($q['show_sticky'])) {
$query['post__in'] = (array) get_option('sticky_posts');
}
wp($query);
return $avail_post_stati;
}
示例6: get_edit_post_link
</a> | <a href="<?php
echo get_edit_post_link($_GET['posted']);
?>
"><?php
_e('Edit page');
?>
</a></p></div>
<?php
$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
}
?>
<form id="posts-filter" action="" method="get">
<ul class="subsubsub">
<?php
$avail_post_stati = get_available_post_statuses('page');
if (empty($locked_post_status)) {
$status_links = array();
$num_posts = wp_count_posts('page', 'readable');
$total_posts = array_sum((array) $num_posts);
$class = empty($_GET['post_status']) ? ' class="current"' : '';
$status_links[] = "<li><a href='edit-pages.php'{$class}>" . sprintf(__ngettext('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts), number_format_i18n($total_posts)) . '</a>';
foreach ($post_stati as $status => $label) {
$class = '';
if (!in_array($status, $avail_post_stati)) {
continue;
}
if (isset($_GET['post_status']) && $status == $_GET['post_status']) {
$class = ' class="current"';
}
$status_links[] = "<li><a href='edit-pages.php?post_status={$status}'{$class}>" . sprintf(_nc($label[2][0], $label[2][1], $num_posts->{$status}), number_format_i18n($num_posts->{$status})) . '</a>';
示例7: wp_edit_posts_query
/**
* Run the wp query to fetch the posts for listing on the edit posts page
*
* @since 2.5.0
*
* @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
* @return array
*/
function wp_edit_posts_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
$post_stati = get_post_stati();
if (isset($q['post_type']) && in_array($q['post_type'], get_post_types())) {
$post_type = $q['post_type'];
} else {
$post_type = 'post';
}
$avail_post_stati = get_available_post_statuses($post_type);
if (isset($q['post_status']) && in_array($q['post_status'], $post_stati)) {
$post_status = $q['post_status'];
$perm = 'readable';
}
if (isset($q['orderby'])) {
$orderby = $q['orderby'];
} elseif (isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft'))) {
$orderby = 'modified';
}
if (isset($q['order'])) {
$order = $q['order'];
} elseif (isset($q['post_status']) && 'pending' == $q['post_status']) {
$order = 'ASC';
}
$per_page = 'edit_' . $post_type . '_per_page';
$posts_per_page = (int) get_user_option($per_page);
if (empty($posts_per_page) || $posts_per_page < 1) {
$posts_per_page = 20;
}
$posts_per_page = apply_filters($per_page, $posts_per_page);
$posts_per_page = apply_filters('edit_posts_per_page', $posts_per_page, $post_type);
$query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
// Hierarchical types require special args.
if (is_post_type_hierarchical($post_type) && !isset($orderby)) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;
$query['posts_per_archive_page'] = -1;
}
if (!empty($q['show_sticky'])) {
$query['post__in'] = (array) get_option('sticky_posts');
}
wp($query);
return $avail_post_stati;
}
示例8: get_views
public function get_views()
{
global $locked_post_status;
$parent = get_post($this->product_id);
$avail_post_stati = get_available_post_statuses('wpsc-product');
$post_type_object = get_post_type_object('wpsc-product');
$post_type = $post_type_object->name;
$url_base = add_query_arg(array('action' => 'wpsc_product_variations_table', 'product_id' => $_REQUEST['product_id'], '_wpnonce' => wp_create_nonce('wpsc_product_variations_table')), admin_url('admin-ajax.php'));
if (!empty($locked_post_status)) {
return array();
}
$status_links = array();
$num_posts = $this->count_variations();
$class = '';
$current_user_id = get_current_user_id();
if (isset($num_posts->inherit)) {
$key = $parent->post_status;
if (!isset($num_posts->{$key})) {
$num_posts->{$key} = 0;
}
$num_posts->{$key} += $num_posts->inherit;
unset($num_posts->inherit);
}
$total_posts = array_sum((array) $num_posts);
// Subtract post types that are not included in the admin all list.
foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
if (isset($num_posts->{$state})) {
$total_posts -= $num_posts->{$state};
}
}
$class = empty($class) && empty($_REQUEST['post_status']) && empty($_REQUEST['show_sticky']) ? ' class="current"' : '';
$status_links['all'] = "<a href='{$url_base}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
foreach (get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status) {
$class = '';
$status_name = $status->name;
if ($status_name == 'publish') {
continue;
}
if (!in_array($status_name, $avail_post_stati)) {
continue;
}
if (empty($num_posts->{$status_name})) {
if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
$num_posts->{$_REQUEST}['post_status'] = 0;
} else {
continue;
}
}
if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
$class = ' class="current"';
}
$status_links[$status_name] = "<a href='" . esc_url(add_query_arg('post_status', $status_name, $url_base)) . "'{$class}>" . sprintf(translate_nooped_plural($status->label_count, $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>';
}
return $status_links;
}
示例9: wp_edit_posts_query
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $q
* @return unknown
*/
function wp_edit_posts_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
$post_stati = array('publish' => array(__('Published'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')), 'future' => array(__('Scheduled'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')), 'pending' => array(__('Pending Review'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), 'draft' => array(__('Draft'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), 'private' => array(__('Private'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')));
$post_stati = apply_filters('post_stati', $post_stati);
$avail_post_stati = get_available_post_statuses('post');
$post_status_q = '';
if (isset($q['post_status']) && in_array($q['post_status'], array_keys($post_stati))) {
$post_status_q = '&post_status=' . $q['post_status'];
$post_status_q .= '&perm=readable';
}
if (isset($q['post_status']) && 'pending' === $q['post_status']) {
$order = 'ASC';
$orderby = 'modified';
} elseif (isset($q['post_status']) && 'draft' === $q['post_status']) {
$order = 'DESC';
$orderby = 'modified';
} else {
$order = 'DESC';
$orderby = 'date';
}
$posts_per_page = apply_filters('edit_posts_per_page', 15);
wp("post_type=post&what_to_show=posts{$post_status_q}&posts_per_page={$posts_per_page}&order={$order}&orderby={$orderby}");
return array($post_stati, $avail_post_stati);
}
示例10: _e
"><?php
_e('Edit page');
?>
</a></p></div>
<?php
$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
}
?>
<form id="posts-filter" action="<?php
echo CP_Custom_Content_Core::GetInstance()->get_manage_custom_content_url($post_type);
?>
" method="post">
<ul class="subsubsub">
<?php
$avail_post_stati = get_available_post_statuses($post_type);
if (empty($locked_post_status)) {
$status_links = array();
$num_posts = wp_count_posts($post_type, 'readable');
$total_posts = array_sum((array) $num_posts) - $num_posts->trash;
$class = empty($_GET['post_status']) ? ' class="current"' : '';
$status_links[] = "<li><a href='" . CP_Custom_Content_Core::GetInstance()->get_manage_custom_content_url($post_type) . "'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, $content_title_plural), number_format_i18n($total_posts)) . '</a>';
foreach ($post_stati as $status => $label) {
$class = '';
if (!in_array($status, $avail_post_stati)) {
continue;
}
if (isset($_GET['post_status']) && $status == $_GET['post_status']) {
$class = ' class="current"';
}
$status_links[] = "<li><a href='" . CP_Custom_Content_Core::GetInstance()->get_manage_custom_content_url($post_type) . "&post_status={$status}'{$class}>" . sprintf(_nx($label[2][0], $label[2][1], $num_posts->{$status}, $label[2][2]), number_format_i18n($num_posts->{$status})) . '</a>';
示例11: count_posts
/**
* Count the posts to be displayed in the table
*/
protected function count_posts()
{
$query_args = $this->get_query_args();
$statuses = $this->get_view_statuses();
foreach ($statuses as $id => $label) {
$status = $id;
if ($id == 'any') {
$status = array_diff(get_available_post_statuses(), array('trash'));
}
$args = array_merge($query_args, array('fields' => 'ids', 'paged' => 1, 'posts_per_page' => -1, 'post_status' => $status));
$q = new WP_Query($args);
$this->view_counts[$id] = $q->post_count;
}
$this->total_count = $this->view_counts[$this->parameters['status']];
}
示例12: cmspo_post_statuses
function cmspo_post_statuses()
{
$p = get_available_post_statuses('page');
$exclude = array('trash', 'auto-draft', 'inherit');
foreach ($exclude as $e) {
unset($p[array_search($e, $p)]);
}
return apply_filters('cmspo_post_statuses', $p);
}
示例13: wp_edit_posts_query
function wp_edit_posts_query( $q = false ) {
global $wpdb;
if ( false === $q )
$q = $_GET;
$q['m'] = (int) $q['m'];
$q['cat'] = (int) $q['cat'];
$post_stati = array( // array( adj, noun )
'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')),
'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private (%s)', 'Private (%s)')),
);
$post_stati = apply_filters('post_stati', $post_stati);
$avail_post_stati = get_available_post_statuses('post');
$post_status_q = '';
if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
$post_status_q = '&post_status=' . $q['post_status'];
$post_status_q .= '&perm=readable';
}
if ( 'pending' === $q['post_status'] ) {
$order = 'ASC';
$orderby = 'modified';
} elseif ( 'draft' === $q['post_status'] ) {
$order = 'DESC';
$orderby = 'modified';
} else {
$order = 'DESC';
$orderby = 'date';
}
wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
return array($post_stati, $avail_post_stati);
}
示例14: get_views
function get_views()
{
global $locked_post_status;
$post_type = $this->args['post_type'];
if (!empty($locked_post_status)) {
return array();
}
$status_links = array();
$num_posts = wp_count_posts($post_type, 'readable');
$class = '';
$allposts = '';
$avail_post_stati = get_available_post_statuses($post_type);
$total_posts = array_sum((array) $num_posts);
//
// Subtract post types that are not included in the admin all list.
//
foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
$total_posts -= $num_posts->{$state};
}
$class = empty($class) && empty($_REQUEST['post_status']) && empty($_REQUEST['show_sticky']) ? ' class="current"' : '';
$all_url = remove_query_arg('post_status', $this->get_admin_url());
$status_links['all'] = "<a href='{$all_url}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
foreach (get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status) {
$class = '';
$status_name = $status->name;
if (!in_array($status_name, $avail_post_stati)) {
continue;
}
if (empty($num_posts->{$status_name})) {
continue;
}
if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
$class = ' class="current"';
}
$status_url = add_query_arg(array('post_status' => $status_name), $this->get_admin_url());
$status_links[$status_name] = "<a href='{$status_url}' {$class}>" . sprintf(translate_nooped_plural($status->label_count, $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>';
}
return $status_links;
}
示例15: edit_data_query
/**
* Clone the core WP function, add the possibility to manage the post type
*
* @param string $q
* @return void
* @author Amaury Balmer
*/
public static function edit_data_query($q = false)
{
if (false === $q) {
$q = $_GET;
}
// Date
if (isset($q['m'])) {
$q['m'] = (int) $q['m'];
}
// Category
if (isset($q['cat'])) {
$q['cat'] = (int) $q['cat'];
}
// Quantity
$q['posts_per_page'] = isset($q['posts_per_page']) ? (int) $q['posts_per_page'] : 0;
if ($q['posts_per_page'] == 0) {
$q['posts_per_page'] = 15;
}
// Content type
$q['post_type'] = SimpleTags_Admin::$post_type;
// Post status
$post_stati = array('publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')), 'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')), 'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), 'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), 'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')));
$post_stati = apply_filters('post_stati', $post_stati);
$avail_post_stati = get_available_post_statuses(SimpleTags_Admin::$post_type);
$post_status_q = '';
if (isset($q['post_status']) && in_array($q['post_status'], array_keys($post_stati))) {
$post_status_q = '&post_status=' . $q['post_status'];
$post_status_q .= '&perm=readable';
} elseif (!isset($q['post_status'])) {
$q['post_status'] = '';
}
if ('pending' === $q['post_status']) {
$order = 'ASC';
$orderby = 'modified';
} elseif ('draft' === $q['post_status']) {
$order = 'DESC';
$orderby = 'modified';
} else {
$order = 'DESC';
$orderby = 'date';
}
wp("post_type={$q['post_type']}&what_to_show=posts{$post_status_q}&posts_per_page={$q['posts_per_page']}&order={$order}&orderby={$orderby}");
return array($post_stati, $avail_post_stati);
}