Skip to content

Commit

Permalink
Update post-order.php
Browse files Browse the repository at this point in the history
  • Loading branch information
krugazul authored Dec 20, 2023
1 parent 2d7da70 commit 0e49c8d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions includes/post-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,27 @@ function lsx_videos_scporder_pre_get_posts($wp_query) {
if (empty($objects))
return false;

if ( is_array( $wp_query->query['post_type'] ) ) {
if ( isset( $wp_query->query['post_type'][0] ) ) {
$post_type = $wp_query->query['post_type'][0];
} else {
$post_type = implode( '', $wp_query->query['post_type'] );
}
}

if (is_admin()) {
if (isset($wp_query->query['post_type']) && !isset($_GET['orderby'])) {
if (array_key_exists($wp_query->query['post_type'], $objects)) {
if (isset($post_type) && !isset($_GET['orderby'])) {
if ( array_key_exists($post_type, $objects) ) {
$wp_query->set('orderby', 'menu_order');
$wp_query->set('order', 'ASC');
}
}
} else {
$active = false;

if (isset($wp_query->query['post_type'])) {
if (!is_array($wp_query->query['post_type'])) {
if (array_key_exists($wp_query->query['post_type'], $objects)) {
if (isset($post_type)) {
if (!is_array($post_type)) {
if (array_key_exists($post_type, $objects)) {
$active = true;
}
}
Expand Down

0 comments on commit 0e49c8d

Please sign in to comment.