"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.
2
votes
2answers
137 views
What is an efficient way to query based on post_meta?
The problem I am having is when I allow users to filter posts it overpowers the database and things run extremely slow. I am unsure what the best way to query posts using meta values is. My site has a ...
1
vote
2answers
47 views
How to query different post types in specific order?
I have 3 posts types, articles, news and tips. On the home page I want to query 20 posts in this order:
article, article, news, news, tip, ...// same order again until 20
If I use a custom query ...
1
vote
2answers
1k views
How do I use wp_query for WordPress search?
I would like to create a custom search form to search posts based on the values of about 4 custom fields. I tried using wp_query to achieve this but so far my biggest problem is that the I don't get ...
1
vote
2answers
114 views
Query last updated posts (posts updated in the last 24 hours)
I'm having some difficulty to find an example of how to create a loop with posts that had been updated in the last 24 hours.
My idea is to have a page of posts or perhaps on the index.php a lists of ...
1
vote
2answers
400 views
Get list of months with posts
I am trying to add a filter on my custom theme based on post month, similar with the archives but with some differences.
What is the best way to get a list of months in witch we have posts?
Thanks,
...
0
votes
2answers
38 views
Looping through tabular data
I am trying to create a table containing information that is a result of two different loops. The first loops through a list of custom post types to display team names. The other is to provide data ...
0
votes
2answers
88 views
Custom search: Search posts but display parent page in results
I'm using Wordpress 3.5.1 with a modified twentytwelve theme.
My main site structure is based on the Smooth Slider plugin (jQuery Cycle).
I have Pages that contain only a shortcode (for example, ...
0
votes
2answers
126 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
2answers
207 views
How to get only ONE category of “Portfolio” posts to display on main page rather than ALL categories?
I have a section on my main page that displays a new “Portfolio” post each time I write one no matter what category I assign them to. What I want to do is make the main page only display one specific ...
0
votes
2answers
59 views
Post Type => Any conundrum
I have a number of regular posts and pages in a regular category called "Featured". I have also installed a plugin called "Event Organizer" that creates its own custom post type called "Event" and has ...
0
votes
2answers
225 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, ...
0
votes
2answers
79 views
Pagination problem after WP_Query with tag filtering
I have a problem with a custom WP_Query. I want a page with all posts with a specific tag. This is the code I'm using:
<?php
//save old query
$temp = $wp_query;
//clear $wp_query;
$wp_query= ...
0
votes
2answers
328 views
How do I Use Multiple Loops with WP_Query?
Hi I am trying to add post from a certain taxonomy term to a cpt loop. The code below is the code I am using.
<?php // Create empty array to store post ids in
$excludes = array();
...
0
votes
2answers
270 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.
...
0
votes
2answers
127 views
comparing dates in custom field
i have a function which should return the future event date:
function get_upcoming_exercises( $limit = -1 ) {
$args = array(
'post_type' => 'px_event',
'posts_per_page' ...
0
votes
2answers
128 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 ...
0
votes
2answers
70 views
WP_Query - meta fields numeric
I'm having trouble with the code below. Attempting to do a query against meta data stored with the posts, in the mls post type. I think I know what the issue is, but not how to fix it. I am ...
0
votes
2answers
144 views
Multiple Orderby's using random order WP_Query
Here is the setup.
The site in question is a website that displays listings. Each listing has a rank (1-3). Basically it's a listing type... small, medium & large to determine how much the ...
0
votes
2answers
198 views
shortcode using multiple WP_Query's with multiple category names not fully functional
we're working on a bilingual site,
Larry A. Downs
all the posts are categorized into two categories, english or spanish, along with other categories. so every post has multiple categories,
i've ...
0
votes
2answers
413 views
Display featured posts for a custom post type by taxonomy
Ok, the quick explanation:
I'm using a custom post type, 'lakes'. And, using custom taxonomies to organize them. They are: state, watertype and county.
I've created a 'page' for each state that ...
0
votes
2answers
235 views
Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”
I am trying to display 3 post_thumbnails from a custom post type "portfolio" on my homepage template. So one from post 'A' , one from post 'B' and one from post 'C' The image from post A will be set ...
0
votes
2answers
161 views
Get all custom_post_type posts + blog posts from one category in a single query
Is there a way to query posts from multiple post_type's and filter the normal blog posts by a category?
I am trying to display the 10 latest custom_post_type posts and blog posts on my homepage in a ...
-1
votes
2answers
235 views
How can i use ajax with check-box categories
Hy
how can i build a search filter someting like that ( ex: http://tvpedia.org/gen/actiune)
with wordpress,
I have a custom post type name: Locatii, that custom post type have categories.
Ex: Cat ...
0
votes
1answer
83 views
using WP_Query() in magento it shows
the magento directory is example.com/app
the wordpress directory is example.com/blog/wp-blog-header.php**
when i using WP_Query() in magento's ...template\catalog\product\view.phtml it shows an ...
0
votes
1answer
199 views
Exclude post formats in custom loop
I'm trying to exclude all post formats but standard from a page template loop that displays 4 latest posts. For some reason I can't get the query to work.
This is my page template
global $paged, ...
0
votes
1answer
132 views
Converting multiple loops into one single loop with pagination
I am using Isotope jquery plugin to filter/sort posts in Wordpress but to correctly filter the posts into the right order I have needed to output each category one after the other. To do this I've ...
0
votes
1answer
160 views
Multiple keyword search
I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...
0
votes
1answer
368 views
Query Custom Post Type by Taxonomy
I've created a query working fine pulling posts from a specific taxonomy—but before I had only 7 taxonomies that were permanent, now I have sub taxonomies under that main taxonomy and they will be ...
0
votes
1answer
125 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
1answer
54 views
Order by meta values
I have 3 meta fields related to dates:
year = 2012
release_date = 14 November 2012
release_date_db = 20121114
I need to show the posts from year 2012 sorted by release_date.
I made this:
...
0
votes
1answer
439 views
Duplicate posts showing up in loop using infinite scroll
I'm experiencing an odd issue using Infinite Scroll for the WP_Query loop on my homepage. Half the time when the second page fires, I'm getting a few duplicate posts showing up in the second set. I ...
0
votes
1answer
424 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 ...
0
votes
1answer
129 views
Select posts that match multiple category names, must match all categories listed
I need to search for posts that belong to multiple categories, but they must match all categories listed, as in if I list category names 'japanese' and 'dessert' the matching posts need to be in both ...
0
votes
1answer
194 views
WP_QUERY tax_query not working
$query_args = array(
'cat' => $lesson_id,
'meta_value' => $lesson_type,
'post__not_in' => array($current_post_id),
'tax_query' => array(
array(
...
0
votes
1answer
20 views
How to specify a certain amount of images queried, not all?
I have a query for calling images from a post category. I am trying to control it to only query 6 images. I have tried using php count, but its not working as expected. Any ideas of what I could do ...
0
votes
1answer
87 views
Execute PHP function inside the admin area
I want to ask if there is a hook for executing php inside the admin area, my problem is I'm trying to do the get_posts wordpress function inside a popup frame using the thickbox jQuery plugin, using ...
0
votes
1answer
381 views
forming WP_Query for posts of all post types but from specific categories
I need to get post from blog, custom post type 1, custom post type 2. custom post type 3 and either from category 1 or category 2 or category 3 or category 4 or category 5 or category 6 or category 7 ...
0
votes
1answer
123 views
WP_Query do not include posts with a certain value in a custom field -
I am trying to grab the 5 most recent posts and have it exclude posts in an array that is already defined ($exclude), sticky posts and any posts that are checked off as a featured post (i.e. with the ...
0
votes
1answer
107 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 ...
0
votes
1answer
108 views
Pagination in wp query with transient api
I have intergrated wordpress transient system with w3 total cache. Now i can`t to do pagination for this query.
<?php
$paged1 = ...
0
votes
1answer
80 views
wp_pagenavi on WP_Query using customfields
I have been searching this subject for some time now, not finding a solution.
First of all, sorry for my bad spelling.
Im quit new to PHP, so please be gental.
Im using this to list some ...
0
votes
1answer
216 views
WP_Query not retrieving by random order under parent
I currently have TWO subpages under parent page ID 43. Client testimonials.. Anyway. I have the random order thing in the query $args but the order never changes. What could I be missing?
...
0
votes
1answer
54 views
Checking url from plugin
I'm trying to change the login url from wp-login.php to simply 'login'. I'd been looking through another plugins source to find ways of doing it.
Some of the applicable parts that I've got so far:
...
0
votes
1answer
150 views
Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
This is my first attempt at modifying the main query using the pre_get_posts action/filter
This is the function currently hooked to it:
function advanced_product_search_filter($query)
{
...
0
votes
1answer
503 views
Custom Post Type “property” (wp-property plugin) query issues
I've got wp-property plugin installed, and I am trying to have a custom query, to retrieve data from the database. If I query posts from other post_type is ok, but when I try to query posts from the ...
0
votes
1answer
383 views
Custom WP Query from meta_value stored as serialised array
I'm using a Magic Fields 2 multicheck box to store Services which can be assigned to Case Studies. The data is stored as a serialised array in WordPress, and I need some help to extract the "related ...
-1
votes
1answer
21 views
Are custom posts included when getting a categories' posts?
Would WP_Query('cat=1') display custom post types, or is that something that I have to specify?
I have a custom post type, am assigning it to a category, and would like for it to be displayed when ...
-1
votes
1answer
50 views
Trying to WP_Query a category
I am trying to output all the posts of a certain category but all that is happening is The page content is being outputted no posts?
template page
<?php
/*
Template Name: Blog
*/
?>
<?php ...
-1
votes
1answer
189 views
How to write short code with if else to get page_id?
<div class="group-training">
<?php while ( $page_loop->have_posts() ) : $page_loop->the_post(); ?>
<div class="entry">
<h1><?php the_title(); ...
-2
votes
1answer
106 views
Get all user with both meta_value
I was wondering if there were any efficient way of fetching all user comparing two different meta_key. I am currently fetching all user compared to the first meta, then loop trough the user_id to ...
