Skip to main content

Questions tagged [wp-query]

"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 global variable that holds the main query object prepared by WordPress based on a given request.

1 vote
1 answer
119 views

WP_Query to find any published post with ID greater than given ID

With WP_Query, I want to retrieve all the published posts with ID greater than a particular ID. Is this possible? I could not find any way. I tried many variations of this, but I don't get the ...
Life after Guest's user avatar
0 votes
1 answer
29 views

Splitting query results, on the frontend, into separate sections based on meta value without multiple loops?

I have a query, sorted by a meta field, and I am trying to figure out how to split the query into different sections based on the meta field. Essentially I want there to be an h2 and a ul for each ...
user13286's user avatar
  • 255
1 vote
1 answer
108 views

Query multiple post types - Order by type and post title title

I have three custom post types which I need to retrieve posts for within one wp_query. I am seeking to return the posts in the order of post type, as well as by post title. Within the question ...
Allen Tullett's user avatar
0 votes
1 answer
24 views

Extra filtering on post query

I have a membership system and want to restrict some posts depending on what level of membership they have. We have some voucher codes which bronze members are elegible for, some voucher codes for ...
StripyTiger's user avatar
0 votes
1 answer
49 views

Query Multiple Post Types and Paginate Newly Created List

I know this has be asked several times but i cant seem to find the answer anywhere. My site has a resources page which is my archive for all resources (archive-resources.php). I'm trying to also ...
user2402492's user avatar
0 votes
1 answer
13 views

When I visit my website there is only slash(-) showing intead of home or my website name. how to solve this? I am attaching image also to understand

When I visit my website there is only slash(-) showing instead of home or my website name. how to solve this? I am attaching image also to understand.
Mansee Rajpoot's user avatar
0 votes
0 answers
26 views

How to filter posts with a wp query by a custom dropdown type field with the magic fields plugin

I have been trying to obtain posts by filtering by two custom fields in a wp query, the problem is that I do not get the expected result, which is that I filter by country and by a value that I am ...
Peter Alexander's user avatar
0 votes
0 answers
67 views

Multiple WP_Query with pagination shows Page/2 content on the remaining pages

I have gone through many articles and scrolled through almost all the questions here but couldn't resolve my issue. So I'll explain my scenario in detail My index.php looks like this which segregates ...
user3362364's user avatar
0 votes
1 answer
87 views

Multiple queries and pagination

I have a homepage and an archive page where I call a template part to have a hero section for the most recent posts, and then loop through the remaining posts as usual. Essentially I don't want to ...
lastnoob's user avatar
  • 153
0 votes
1 answer
18 views

post per page for differents post types in a same query

How can I make a query and in the same query query many types of publications and also define the number of publications for each one.? This is what I have in my query $post_types = array('infografias'...
Peter Alexander's user avatar
0 votes
1 answer
31 views

posts_per_page showing 16 elements instead of 3

I need help with this. Whatever I add to 'posts_per_page' value, it shows 16 posts for some reason.. <?php $args = array( 'meta_query' => array( array( ...
t0mii's user avatar
  • 3
0 votes
2 answers
53 views

How to get products with the same custom attribute like ean code

I Try to get all products with the same ean code, but the query doesn't work and also doesn't give any errors. What am I missing? Here is the code I use. if (is_product()) { global $product; $...
apero's user avatar
  • 101
0 votes
0 answers
21 views

I need help with filter products in custom teplate

I need some help with code below. I created a custom template and I am trying to get all the products, variations and their stock in a table and then try to filter them in products categories and in ...
aggz's user avatar
  • 1
0 votes
0 answers
38 views

filter the custom post type using wp ajax request

I want to filter the custom post type (events) using wp ajax request on behalf of the keyword supplied to it. Explanation: I have a from which has 4 fields displaying search keyword, event category (...
Manish Agarwal's user avatar
0 votes
1 answer
142 views

why same category base and single post base don't work?

I have checked a similar question on the site but there was no satisfactory answer? Here is what I would like to accomplish. When I set the permalink structure to '/blog/%postname%/' this gives me the ...
yucelm's user avatar
  • 3

15 30 50 per page