I have a Categories name ‘Trending’ and ‘Top’ I want to display all posts on both of these Categories pages. I don’t want to write custom query I want to edit “global $wp_query;” object and remove “cat” from the query to display all posts.
How it possible?
My Code snap:
global $wp_query;
if (isset($wp_query->query_vars[$monstrotheme->settings->slugs->frontendPosting->addNew])) {
$this->data['specialPage'] = 'frontend-submit';
$this->data['currentContentLayout'] = 'page';
} else if ($wp_query->query_vars['pagename'] == $monstrotheme->settings->slugs->login->login) {
$this->data['currentContentLayout'] = 'frontPage';
} else {
if (is_front_page() || is_404()) {
$this->data['currentContentLayout'] = 'frontPage';
} else if (is_post_type_archive('gallery') || is_tax('gallery-category') || is_tax('gallery-tag')) {
$this->data['currentContentLayout'] = 'galleryArchive';
} else if (is_post_type_archive('video') || is_tax('video-category') || is_tax('video-tag')) {
$this->data['currentContentLayout'] = 'videoArchive';
} else if (is_archive() || is_search() || (is_home() && !is_front_page())) {
$this->data['currentContentLayout'] = 'postArchive';
if (is_category('Trending')) {
// Here I want to alter the query
}
} else if (is_page()) {
$this->data['currentContentLayout'] = 'page';
} else if (is_single()) {
switch (get_post_type()) {
case 'video':
$this->data['currentContentLayout'] = 'video';
break;
case 'gallery':
$this->data['currentContentLayout'] = 'gallery';
break;
default:
$this->data['currentContentLayout'] = 'post';
}
} else {
exit;
}
}