"wp-query" ambiguously refers to one of two things. 1) WP_Query is a class native to Wordpress which allows users to query the posts database using a number of criteria. 2) $wp_query is the default object that holds the main query object on each WordPress page.

learn more… | top users | synonyms

0
votes
0answers
23 views

Using an actual page for 404 instead of a template

How would I override the 404 template and fetch a whole page instead? Currently I have achieved this by doing a http request from 404.php(the 404 template) to http://example.org/error404, which in ...
0
votes
1answer
21 views

Return on a quest all these meta_value

<?php if(isset($_REQUEST['src'])): $business = $_REQUEST['srcbusiness']; $type = $_REQUEST['srctype']; $price = $_REQUEST['srcprice']; $city = $_REQUEST['srccity']; ...
0
votes
1answer
24 views

Wordpress Query posts that have title > another title

I am trying to make a query of a custom post type that searches the next 3 posts alphabetical order after a specific title. A snippet of the args wp_query is $vars = array( 'paged' => $page, ...
0
votes
1answer
41 views

Add a custom variable to query page object

Is there a way to add a custom variable to the queried object? if (is_page()) { $q = get_queried_object(); $term_id = $q->term_id; } Here's some background on my setup. I have a page ...
0
votes
1answer
23 views

Searching for meta_key returns 0 posts

I am currently on a client project and I am stuck with the meta_key search in WP_Query. I am querying some other parts of the homepage successfully with the WP_Query class, but when I am passing ...
0
votes
0answers
41 views

New WP_Query calls Pre_get_posts filter twice

On my WP theme template page, I am running a new WP_Query. It seems to be calling my pre_get_posts filter twice, which then wrecks my custom parameters. The second time the pre_get_posts filter is ...
0
votes
0answers
20 views

Multiple Meta_Query using an array to search

I've got the following code from a previous developer which searches through a meta_key called new_location to match a location ID to a meta_value. It works fine for up to 3 different locations at ...
0
votes
0answers
28 views

Repeating a loop after x amount of time

I'm new to Wordpress and PHP and would really appreciate a little pointer regarding a problem I can't solve: I have a Wordpress site and in my Homepage I have a section that when the page loads ...
0
votes
1answer
48 views

WP_Query order by date in meta_value

i have a small problem i think. this is my code for my category-releases.php: <?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' ...
0
votes
1answer
81 views

Pagination not working

I have been using the same pagination query for the majority of the websites i have created. This time it is not working for some reason I have used the pagination trouble shooting links Here but ...
0
votes
0answers
28 views

WP_Query custom field pass the post id

I'm using WP_Query with ACF(Advanced Custom Fields) I'm building a news portal, and I'm trying to pass related stories from 1 post which is top_story = true. In another WP_Query I want to print the ...
0
votes
1answer
34 views

How to use 'WP_Query' or 'query_posts' to display content in a descending order

How can I list posts in a descending order of the $json_data->data[0]->total_count values ? I want to display top shared posts descending, but I can't really use WP_Query or query_posts the ...
0
votes
1answer
41 views

How to use global post counter in the loop?

In the Loop use this code <?php $count = $wp_query->current_post; echo $count; ?> On first page post counts from 0 to 14, but from second page post counts from 0 to 14 to. How use global ...
0
votes
2answers
45 views

WP_Query a custom field value bringing back 0 results

I am trying to do a query to grab all the pages that have the tickbox checked "feature_on_front_page" which has the value "featured" with label "Featured". I added this checkbox with ACF. My query ...
0
votes
1answer
29 views

What is wrong with my WP_Query Arguments?

In my single.php file I am using a nested WP_Query to show more posts, at the bottom of the page. My code for the query and nested loop are as follows: <?php $ep_args = array( ...
0
votes
1answer
29 views

Displaying All Data from Custom Post Type Fields through Advanced Custom Fields

I have looked all over Google, trying to figure this out. I've made some progress but still stuck. I'm pretty new to ACF and custom post types. I have a custom post type of "Attorneys" that I setup ...
0
votes
1answer
45 views

Search Functionality broken by the wp 4.2 update

I run a blog site with posts by authors, and I implemented a search that would return results if the search was like an author's name or the search term was contained in a story. I was functioning and ...
0
votes
0answers
26 views

Combine WP_Query results with new WPDB->get_results Query

Is it possible to combine results from a WP_Query array with results from a new WPDB get_results() and use the loop to loop through the results? Essentially, I am trying to modify a shortcode that ...
0
votes
1answer
33 views

Accessing GET variable named 'error'

As part of a project I'm required to make a wordpress plugin which integrates with Google for authentication (There are good reasons for developing a new plugin instead of using an existing one). If ...
0
votes
1answer
24 views

WP_Query function for custom post type

I've got a CPT for random homepage banner images (so we can test different images and call to action language). I've got a custom field for the post type that accepts a specific ID for each banner so ...
0
votes
2answers
28 views

How to display specific ids of posts using wp_query?

I have 7 services in a page. All 7 services have featured images. I want to show all the 7 images and content in a slideshow. $args = array( 'post_type' => 'page', 'post__in' => ...
0
votes
0answers
17 views

Is it possible to combine multiple category__in arguments?

I want to produce a query that returns posts which are in one array of categories and also in another array of categories. So, if my two arrays are: $offices = Array ( [0] => 73 [1] => 74 ) ...
0
votes
0answers
29 views

Override default posts per page in taxonomy template

I am using the following code to show ordered list of posts in taxonomy page: <?php $mypage = (get_query_var('paged')) ? get_query_var('paged') : 1; $ppp = get_query_var('posts_per_page'); ...
2
votes
3answers
167 views

WP_Query and Pagination on a Static front page

For the past two days I've been trying to debug an issue with WP_Query() and Pagination. A website I'm a dev for uses a Wordpress theme (Salient by ThemeNectar) that includes the visual composer ...
0
votes
0answers
19 views

Ordering by custom post meta key

I'm using the plugin WP Job Manager, and have a custom field with the meta_key "rating". I want to be able to order listings by rating, using "orderby". Normally for posts I imagine it would be ...
0
votes
1answer
14 views

Filter custom post type by custom taxomony

I have several custom post types, each with one or more custom taxonomies. I'd like to add a filter for each taxonomy to the relevant custom post type edit screen, but my solution is not working. ...
4
votes
3answers
168 views

Better way to get tag stats?

I have over 4000 posts. I am trying to query all the posts and get the count of tags each post has and sum up posts count based on number of tags the post has in dashboard. The posts count shows up ...
1
vote
1answer
57 views

List only posts from specific category on category page

I wanted to ask if there is a shorter way then by checking each time if the post is coming from a specific category. As you can see the categories cover the alphabet, A B C etc and each time I check ...
0
votes
3answers
29 views

get_posts with multiple categories

If I do a get_posts() with category set to 1,2 I will get all posts in category 1 OR 2. If i want all posts whit both categories, that is 1 AND 2, how do I make that request?
0
votes
2answers
36 views

current_post not working - give me -1 for every post

I try to get the current post index number and echo the number of this lesson(post)in a series of lessons(category). I'm inside the loop on single.php page my code looks like this: $args = array( ...
6
votes
1answer
59 views

How to add taxonomy filter on the query fly?

I try to add tax query on pre_get_posts hook using following code : // Add custom posts to main query (archive and home) add_action( 'pre_get_posts', 'add_post_types_to_query' ); function ...
2
votes
1answer
78 views

How get posts from a subcategory of a category by name?

I'm trying to create a subcategory template of a defined category. For example, for each one, I would like to check if his subcategory Photos exists and to get posts of this. Here is my category ...
0
votes
1answer
28 views

Get posts associated with custom taxonomy alternate way

I have a custom post type named artwork and I'm trying to get all of the artwork that is associated to the custom taxonomy of artists on the taxonomy-artists.php page. I found an example here which ...
4
votes
1answer
55 views

WP_Comment_Query pagination, delving into the unknown

I am aiming to pagination WP_Comment_Query(). It appears this is either taboo or there is no viable information about it online, not anything. Why? Is it possible? If so, how?
0
votes
1answer
29 views

How to convert query sql to shortcode in wordpress?

I want to make a shortcode like this [myshorcode:2:drinks], and query-wrangler I have managed to get the following query that shows me 2 products of a certain taxonomy PHP WP_Query: $query = array ( ...
0
votes
0answers
7 views

Paginate Multisite Attachment WP_Query

I am working on a multisite blog network where I need to display x post per page and navigation at the of the bottom list. My code will not display a pagination at the bottom and displays x post per ...
0
votes
1answer
72 views

Display post list within category list sorted by name [duplicate]

I'm trying to display a list of categories sorted by name and all posts of each category inside it. Like this: Category A Post B Post F Post Z Category B Post A Post C Post G Category C Post D ...
0
votes
1answer
19 views

problems with comments_number()

Why does the following code: echo '<ul>'; while ( $query->have_posts() ) { $query->the_post(); $title = get_the_title(); echo '<li>' . $title . comments_number() . ...
0
votes
1answer
10 views

Issue attempting a wp_query_posts with tags

Having an issue trying to query the most recent posts using the tag, in this case, trending. I used the following code but I get no results. If I switch out 'tag' to 'post_type' it will work: ...
0
votes
1answer
116 views

Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms

I am trying to build an advanced search form that allows users to select from two taxonomy based drop down menus. Each taxonomy drop down has taxonomy terms from which the user can select multiple ...
0
votes
1answer
57 views

Add banner after the third post [closed]

How do I add a banner or a DIV with content after the third post on the index or category of Wordpress 4.0? // Start the Loop. while ( have_posts() ) : the_post(); ...
-1
votes
1answer
57 views

tax_query not working properly with get_posts

Here are my args: $args_home = array( 'post_type' => array('news', 'jobs'), 'posts_per_page' => 12, 'meta_query' => array( array( 'key' => '_thumbnail_id' ...
0
votes
0answers
14 views

How to create a collection of terms used by posts from wp_query

I am creating a custom search results page that has a WP_Query that looks like this: $args = array( 'post_type' => 'manuals', 'posts_per_page' => -1, 's' => ...
0
votes
1answer
37 views

Sorting Posts by custom field

I'm trying to sort my posts by the custom field artwork_title. When I use the following code, I just end up with one particular category of posts no matter what category archive I'm on. Also ...
0
votes
0answers
52 views

Are there security issues with Visual Composer add ons?

I am developing some add ons for Visual Composer. They are quite client specific so I am not planning to submit the plugin to VC as official add on suggestion. I used this bitbucket code to start ...
0
votes
0answers
54 views

Wordpress WP_Query offset parameter not working with search parameter

On a wordpress query every time i add the 's' parameter the 'offset' and 'posts_per_page' will not work, it will query all posts by using the 's' parameter only, why is that? am I missing something? ...
0
votes
1answer
54 views

Using page slug in wp_query

I'm currently in the process of building out a site for a legal firm that's a client of ours. We have a two custom post types, attorney's and cases, that we need to link together in various areas ...
0
votes
0answers
28 views

Pass tax_query variables in URL

I'm trying to create some URLs rewrite for my site, but now I'm stuck. I have this structure in my permalinks: example.com/%custom-type%/%category%/%postname% The full URL is already working: ...
0
votes
1answer
21 views

Query post Pagination Problem

I am using following code for query post but I am not getting pagination link. Where is the problem of the following code. <div id="primary" class="content-area"> <main id="main" ...
-1
votes
1answer
39 views

Randomly display posts on a site hosted by WPEngine? [closed]

I'm aware that WPEngine will allow you to enable the "Allow ORDER BY RAND()" setting in the dashboard but I need to find an alternative method to avoid performance issues. I have a custom post type ...