"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.
0
votes
1answer
56 views
Display products from specific category in shop page
I know many people asked for this question but I didn't find a proper way to do it. How to add a simple meta_query (product_cat) before the execution of the shop page's query.
Maybe by using a filter ...
0
votes
2answers
236 views
twentyeleven_content_nav hook no longer outputs navigation link after 3.5 upgrade
After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins.
...
1
vote
3answers
698 views
Custom URL parameters in template files
SETUP
I want to pull a query variable from the URL and use it on my single post template (single.php). For example: mysite.com/2011/07/29/testPost/?myvar=someValue
To do so, I added the custom query ...
0
votes
2answers
116 views
How to query custom post then display sections by meta value
This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run ...
1
vote
1answer
131 views
WP_Query orderby breaks when using AJAX?
I'm running in to a bit of a problem.
I have a function called get_press(), it retrieves newest press items. It is inside of a plugin:
class EWPress {
function __construct()
{
...
2
votes
1answer
34 views
add_filter and remove_filter added before and after wp_query
I have just started with WordPress Development, and found following block of code online (in some tutorial)
function filter_where( $where = '' ) { // posts in the last 30 days
$where .= " AND ...
0
votes
1answer
132 views
WP_Query breaks pagination
I've been on this problem for a week now. I've searched through countless posts that just aren't answering the question. It seems that my wp_query breaks pagination. I've looked through a lot of the ...
0
votes
1answer
103 views
Filter subpages in while loop from WP Query object
I'm looking to optimize a page where I'm using several queries (with WP Query) to retrieve similar data, and I'm considering merging these queries together then filtering for relevant data once ...
-1
votes
0answers
42 views
List custom post type URLs based on user form selection
I'd like to set up a form with dynamically populated radio buttons for all custom post types. Something like this:
custom post type 1
custom post type 2
custom post type 3
continued for all CTPs...
...
0
votes
1answer
36 views
Display posts from a category
I am trying to display a bunch of posts from a single category on the category page, using multiple loops.
<div id="featured-content" class="clearfix">
<?
// assign the variable as current ...
0
votes
1answer
33 views
next_posts_link returns same content of 1st page
Pagination seems to work fine... I have 21 posts... and it will go to 3 pages... however... every page shows 10 posts and the same content as the first page....
<?php
$temp = $wp_query;
$wp_query= ...
1
vote
3answers
155 views
WP_Query can't exclude more than 1 author?
It seem wp_query have the problem where it does not accept more than 1 negative value in author argument. for example:
$args = array('author=-2,-3,-4');
$newquery = WP_Query($args);
This grab ...
0
votes
1answer
102 views
Attempt to display site authors in a carousel - User Image not Outputting inside li tags
I am attempting to display the authors of my site in a jquery carousel but for some reason my images are outputted outwith the li tags and I don't know why.
Code
functions.php
function ...
1
vote
1answer
83 views
Using OR in WP_Query negates the “NOT EXISTS” compare
I'm attempting to filter posts by a custom field that either are equal to 'new' or have not been set yet. I'm able to get either of those meta_queries to work on their own but when I use them in an ...
0
votes
1answer
157 views
Using WP_Query and Query_post for the loop?
I am using the code below to call post from a certain Taxonomy term. My intentions are to mix that into the normal loop.
I'm am not trying to create two different loops, but one loop that displays ...
0
votes
1answer
81 views
wp-query Shortcode in Gravity Forms Notification
I have the following code that runs two wp-query loops upon form submission to display specific posts depending on the users choices in the form (The form fields are radio buttons with values that ...
0
votes
1answer
31 views
Highlight post in sidebar on single page
When you have a menu for say pages, it's easy to highlight your current page, since WP puts a class on it.
But what I have is a sidebar with the 20 latest posts in a loop and a separate main content ...
4
votes
1answer
111 views
How can I save an array from a random post sequence for later use?
I'm building a random workout generator on Wordpress to help with my fitness, and am stuck at saving random post arrays for later reference.
I'll explain.
The generator should work in two main ...
0
votes
1answer
40 views
404 on Pages for Custom Post Type & Query_Posts
It took me quite a while to find a good solution for ordering a custom post type by two custom meta keys. When I finally got it working, I found out the pagination no longer works. I've tried dozens ...
0
votes
1answer
40 views
Can you order posts from wp_query by two custom meta fields?
I'm working on a site that lists events. Right now this query lists events by date:
$args = array(
'post_type' => 'espresso_event',
'post_status' => ...
3
votes
1answer
207 views
WP_Query ignores post_type in category view
I have following query to select posts by my custom post-type. This works fine while being on the frontpage (the snippet is included in the sidebar). As soon it gets executed on a category page the ...
1
vote
1answer
264 views
Get posts with tag all post types
I'm trying to get all posts that have a specific tag, regardless of what type of post that is. I've tried every solution I've found (here on SO and further), but nothing works: I always only get the ...
0
votes
1answer
118 views
Pagination in custom query not working
hi im trying to output pagination without any success. below is my code in a page-products.php template
<?php $products_query = new WP_Query(array(
'post_type' => 'product',
...
0
votes
0answers
26 views
Custom Post Query Combined with Conditional Tags
Is it possible to combine displaying a list of custom post types on a single page depending on conditional tags?
Below is what I have so far, basically if there are 4 posts or less show the posts, if ...
0
votes
1answer
158 views
How to insert multiple postmeta values with one query?
I have a custom script/plugin I am using for myself that creates a post along with some postmeta information. Right now, I have multiple $wpdb->insert, but I would like to condense this down into ...
1
vote
1answer
151 views
WP_Query - filter by multiple meta values and order by other meta values
I'm trying to query posts using WP_Query and meta_query parameters:
$args = array(
'post_type' => 'produkty',
'meta_query' => array(
'relation' => 'AND',
...
0
votes
1answer
409 views
search query within custom taxonomy term, post title and meta field
I want to create a search that does:
Search within my custom taxonomy - custom-tags
search the post title
search select meta field ?? dont know
search with custom post type - easy part
I looked ...
1
vote
1answer
42 views
creating wp query with posts with specific category
Im running a specific wp_query to show the thumbnails in a slider of a specific category.
<?php $the_query = new WP_Query ('showposts=2', 'category_name=Events'); ?>
This doesnt appear to be ...
0
votes
1answer
202 views
wp list pages using meta box value
I am using following meta boxes on services page but how i get page which on meta box value...
for example list all pages where service_type = 'web'
I am using following now...
<?php ...
0
votes
1answer
20 views
Finding a post's slug
I'm using wp_query() to get custom posts from the database. I want to list these out as links to the entries, so I'm thinking I could use the slugs. Sadly these don't seem to be included in the ...
0
votes
1answer
36 views
wp_query in a shortcode
I am trying to put several queries in a shortcode so that I can call them in a page instead of using custom templates. I got my query going but I only see some of the content on the page. The image ...
0
votes
1answer
40 views
How to use WP_Query in a CPT achive page?
I can't get WP_Query to work in my custom-post-type archive page. Can someone please tell me what I'm doing wrong? I would appreciate any help.
Here's the code in archive-bulletin.php:
<?php ...
2
votes
3answers
1k views
Archive Listings Filtered by Date Values in a Custom Field/Post Meta?
(Moderator's Note: The original title was "using archive by date with a custom date")
I'm adding an additional date to posts as a custom field. Now I want the archive to show posts by the custom date ...
1
vote
3answers
473 views
Create unique page without header.php for json feed
I have two WordPress sites on separate domains. I need to expose the latest posts within a category via a json feed on one site that I have to use for the other site. I'll need to hit a "hidden" url, ...
0
votes
1answer
41 views
Cant' Display Custom Post Type Title Base on Tax Terms
Trying to list all Custom Post Type titles based on filtered Custom Taxonomy Terms I am getting the list of all post titles instead of getting the list of Queried post.
Here is the code I am using:
...
3
votes
4answers
3k views
Counting Posts of a Given Post Type Having a Specific Taxonomy?
(Moderator's note: The original title was "How to know the number of custom type posts having a specific taxonomy")
I'm stuck with the function wp_count_posts()!
I created custom post types called ...
0
votes
2answers
184 views
Recent Posts slider, using WP_Query(), loads duplicate sliders
I have written a small piece of code for Wordpress that will show the most recent top 4 posts in a slider (the Filament Group Responsive Carousel). It works, displaying the posts and sliding them etc, ...
6
votes
5answers
4k views
Wp get all the sub pages of the parent using wp query
Here is my code
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page','post_parent'=>$parid,'orderby'=>'title','order'=>'ASC' ));
It displays ...
5
votes
1answer
166 views
Multiple relationship for multiple tax_query in WP_Query
I want to use the WP_Query class to filter some of my posts. The problem I facing now is handling the taxonomy query. Normally, the wp_query only handle one relationship for tax_query (either AND or ...
6
votes
2answers
7k views
WP_Query with “post_title LIKE 'something%'”?
I need to do a WP_Query with a LIKE on the post_title.
I started with this regular WP_Query:
$wp_query = new WP_Query(
array (
'post_type' => 'wp_exposants',
...
0
votes
1answer
33 views
Problem with is_tax in WP_Query loop
The code below is the 2nd of 4 loops in "page-balls.php". Everything else is working correctly.
I'm trying to display a tennis ball graphic if the post being retrieved has a the term "tennis-ball" ...
0
votes
1answer
47 views
WordPress | WP_Query does not return anything with s=a
I have the following code:
$data = new WP_Query('s=a');
and the print_r returns the following data:
WP_Query Object
(
[query_vars] => Array
(
[s] => a
...
1
vote
2answers
47 views
Next/Prev posts on same page
Hello WordPress Users,
I'm stuck with a problem building my wordpress website and I can't figure out what to do about it.
Currently I'm showing 2 posts form the category 'News' at the page 'News'. ...
0
votes
1answer
40 views
WP Paginate not working properly
Im creating a WP for a custom type post in a page template:
<?
global $paged;
global $notquery;
$temp = $notquery;
$notquery = ...
2
votes
2answers
671 views
How to trigger 404 for custom query var?
How can you trigger a 404 when using custom query vars? I've got re-write rules written for a custom query var, but if you were to request a URL for the query var that should technically be a 404 it ...
0
votes
1answer
144 views
wp_query should show stickies first
I have the problem that my theme is for some reason always showing the latest posts at first. I would however like it to show all stickies at first and then show the regular ones. Here is the code:
...
0
votes
0answers
39 views
$wp_query empty on my home page
I've got a Multi-user install set up with several sites, each with a few posts. I recently added a new user, made it a super-admin, and then deleted the original super-admin. I transferred all the ...
4
votes
1answer
183 views
Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
I've registered custom rewrite rules and query_vars to use for displaying a list of events based on ISO date format. For example when a user requests the URL, http://site.com/by-date/2013-04-04/, my ...
1
vote
1answer
15 views
Query “Category A” + 1 post from “Category B” - how?
It's pretty easy to query posts from one category but what if I need also one single post from another category?
$query = new WP_Query( 'cat=4' );
I'm looking for something like this:
$query = new ...
0
votes
1answer
32 views
WP_Query calls all posts?
I have this code that picks a random testimonial post.
<?php
$quote_args = array(
'post_type' => 'post',
'category' => 'quote',
'orderby' ...



