"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
0answers
36 views
How to implement time filter to show random post 1 month for one category and 3 months for other categories
I started to work on one website after another developer and there is problem with his "popular widget" which is basically showing 3 random posts from category. There is some Switch statement which is ...
2
votes
0answers
72 views
Warnings in nav-menu when visiting query pages
Using query-wrangler, similar to drupal's views, I created some query pages.
When I visit these pages, in the top-navigation-menu there is this warning:
Warning: in_array() expects parameter 2 to be ...
2
votes
0answers
40 views
Query meta field using between
I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that.
Let says I have these in the database
Meta-key: lat
Meta-value: 54.3415000
...
2
votes
0answers
40 views
When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?
This question is a follow up to a question I recently asked.
I've implemented what seemed to be the only solution, and it seems to work (YAY!). I just need to verify that:
This is really the only ...
2
votes
0answers
65 views
Excluding posts from a category but only they're not in multiple categories
I am looking to exclude a category in Wordpress. I am referring to the Wordpress Codex page on wp_query but I am having the following problem:
I want to exclude posts from category 1, but if a post ...
2
votes
0answers
89 views
Enforcing canonical URLs with multiple custom post types
I'm working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the 'parent' of the others. For example, say I have a ...
1
vote
0answers
15 views
database query with more than a couple meta hangs and doesn't complete
I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the ...
1
vote
0answers
18 views
How to output topics and replies in bbpress as table?
I need to output the bbpress topic and reply loop in a table format. I'm having trouble finding how one might do this Are there any suggestions on how one might do this? Can this be done using ...
1
vote
0answers
26 views
Meta Query And/Or
My question is very similar to Meta Query with AND & OR? . This question was answered in 2011 by @Otto.
With the exception that my logic is different.
I want to query, for example, posts with ...
1
vote
0answers
46 views
Keep sticky posts out of query unless they have featured image
I have a query running which prevents posts without various criteria from appearing, one of these is the necessity to have a featured image. Sticky posts however seem to end up in the query ...
1
vote
0answers
72 views
Query custom post types and a specific page?
I'm using this query WP_Query('post_type=product&posts_per_page=8') I need to include a specific page into the query but not sure how to add it since I'm only specifying the custom post type? Is ...
1
vote
0answers
63 views
how do i combine keyword search and taxonomy in a WP_query $args array Worpresss
I'm trying to figure out how to get the following code to work as one wp_query . i'm trying to filter the loop on the search values and the taxonomy values:
Both of these sections work independently ...
1
vote
0answers
49 views
Is it possible to orderby multiple meta_keys when using meta_value_num?
Reading through the order & orderby documentation, it's not clear to me whether there is any support to order based on multiple meta_key values.
Obviously, using meta_query I can return posts ...
1
vote
0answers
128 views
get_query_var() not working in pre_get_posts
I'm using the pre_get_posts hook to order the main query on all my custom post type / taxonomy pages using a custom meta value. As part of the logic, I am trying to determine which taxonomy is ...
1
vote
0answers
92 views
Custom post query by taxonomy
I am using WordPress 3.5. My query is,
$args = array(
'post_type' => array('product', 'comic', 'magazine'),
'taxonomy' => 'Genres',
'term' => 'hot',
'posts_per_page' => ...
1
vote
0answers
79 views
How to increase load time of an archive/search page (WP_Query)
I'm currently looking at why the archive and search pages take so long to use, and have found that the bulk of processing time is spent on the query_posts that is called before the template has even ...
1
vote
0answers
219 views
Display one post from each term in a custom taxonomy
I am trying to display a list which shows one post (and information about the person posting) from each custom taxonomy term.
The code I am using is as follows, but it is instead printing out EVERY ...
1
vote
0answers
55 views
Display posts with comments closed, with pagination?
i'm using a custom query, which needs to display all posts with closed comments.
I have this
<?php $the_query = new WP_Query('showposts=-1'); ?>
<?php while ($the_query -> have_posts()) ...
1
vote
0answers
49 views
can these 3 queries be re-written as 1 query?
I am creating a Dentist directory site, and I have a taxonomy archive page which requires particular grouping and sorting (see below). So far I have only been able to achieve this using 3 WP_Querys ...
1
vote
0answers
125 views
Should i use wp transient with w3-total-cache apc caching
Should i use in my queries wp transient like this -
<?php
if ( ! $my_paged = absint( get_query_var( 'paged' ) ) )
$my_paged = 1;
if ( ! $my_query = get_transient( "567recent_$my_paged" ) ...
1
vote
0answers
57 views
WP_Query Attachment adds additional attachment count and need to link attachment to post url
I just wonder why WP_Query adding one more additional attachment with the defined number or posts. Also need to link attachment (thumbnail) to the post url. Here is my code
<?php
$query = new ...
1
vote
0answers
144 views
Trying to perform complex custom field query with order by set to field value
I've got two custom fields for event posts: event-start and event-end. When I'm querying for current events, I'd like to show any post where the event-start OR the event-end is greater than or equal ...
1
vote
0answers
171 views
Does the WP_Query 'private' argument for post status only apply to privately published content?
The only peice of code that I can find that applies to this is on line 2430 in query.php in WP 3.4.1
foreach ( get_post_stati() as $status ) {
if ( in_array( $status, $q_status ) ) {
if ( ...
1
vote
0answers
106 views
Query most popular terms by taxonomy over 2 week period
I have written SQL for a query that pulls the most used taxonomy terms for selected taxonomies that are published, do not have a parent post are not in a comma separated list over the past two weeks ...
1
vote
0answers
49 views
Get page content by category or tag
I'm trying to sort of emulate the Views behaviour in Drupal with Wordpress, but doing it in theme templates.
Now, I have pages that are assembled by using wp_query in the template to get posts ...
1
vote
0answers
182 views
How to use Meta Value Compare in WP_Query For Max and Min numbers
I am using WP_Query for visitor to filter the posts. The posts is about products. So in the filter, it has a field where user can select Maximum price and Minimum price. (Just like most of the ...
1
vote
0answers
62 views
Posts published last 10 minutes
i have a "featured" section on home page.
i want to hide this section after 10 minutes of post publish time.
here is the code, i am using.
problem is that it hide the "featured" section after 12 ...
1
vote
0answers
116 views
List authors with the last post title and order by last post date
I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them.
// Selects from tables wp_users and wp_posts, selecting published ...
1
vote
0answers
860 views
Filter wordpress post categories with jquery/ajax and pagination?
Currently I have a website working with Wordpress and Jquery Quicksand (http://razorjack.net/quicksand/).
However I don't want to show all posts at the same time. I wish to show e.g. 6 posts and then ...
1
vote
0answers
217 views
How to order posts by meta_value and title
How do you order products in WooCommerce so that products are random, but at the same time featured products show first?
Here is my code:
$args = array(
'post_type' => 'product',
...
1
vote
0answers
185 views
Query two taxonomies via URL or link (ie. not via specific template)?
I've been banging my head about this, and have created a work around, but it would be much nicer for my site's organisation if I could figure this out:
I want to be able to query posts across two ...
0
votes
0answers
28 views
Doesn´t get right information from wp_Query in wordpress using Easy Content Types
Have problems to sort out right information using WP_Query together with Easy Content Types. My query looks like this
<?php
$query = new WP_Query( array( 'post_type' => 'buildarea', ...
0
votes
0answers
15 views
Wordpress $wpdb->query() inserts multiple rows with duplicate data
I am experiencing very strange problem with wordpress query() function.
I have a form on page 1 where below code to insert a new record.
if(isset($_POST["transaction_id"])){
global $wpdb;
...
0
votes
0answers
31 views
Create args for WP_Query using infinite scroll
I'm trying to use infinite scroll in my page as below.
http://phototravel.flop.jp/category/japan/mothersfarm/
All photos are actually custom posts under a category. It's using jquery masonry layout.
...
0
votes
0answers
28 views
Reduce number of SQL queries inside WP_Query loop to fetch author data
This question applies to scale and does not concern typical blog implementations. I'm working on a web app where I'm running standard WP_Query to fetch some custom post types. This usually results in ...
0
votes
0answers
20 views
Complex WP_Query Using Post Date And Post Meta
I am using Wordpress as a CMS on a website which has standard posts, a custom advert post type and a custom event post type. The event post type has some custom meta which stores the event start date.
...
0
votes
0answers
28 views
Search with meta_query and tax_query
I'm working on a little database for series based on wordpress. I've implemented a custom post type called "anime", some taxonomies (Genre, a_types..) and a lof of customfields. (based on acf). Now ...
0
votes
0answers
16 views
When importing a database any page with a wp_query in doesn't work
I've noticed this a lot, when I export a database from a test site and import it into a live site, any (or most) page with a wp_query in it doesn't show up correctly (It shows the theme, but as though ...
0
votes
0answers
28 views
Custom WP_Query for WordPress Search Results with meta_query
I am using a custom query to generate my search results. The code I am using works perfectly without the meta_query variables in my arguments array.
I am trying to compare multiple custom fields with ...
0
votes
0answers
30 views
Advise on Templates for Custom Queries
I'm trying to figure out the best way to solve this problem. I have a couple of archive type pages that display content from multiple post types at once. For example, I've overridden the default ...
0
votes
0answers
31 views
Multiple homepage layouts as selected by user from theme options
I am working on a theme which will enable users to select multiple layouts from the theme options panel.
What I did so far is to create multiple theme files, depending on each theme, put it in a ...
0
votes
0answers
46 views
Creating Advanced Search with text & Dropdowns
I am working to develop an advanced search option. Where there will be fields:
Text input Field (Post Title)
Dropdown (it will be a taxonomy)
Dropdown (it will be a taxonomy)
Basically I need ...
0
votes
0answers
47 views
Query recent posts by author
I'm fairly new to wordpress but trying to get recent posts by a specific author. The following code displays only most recent bog posts. I am using a custom field to get the author ID.
EDIT by ...
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
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 ...
0
votes
0answers
29 views
Display Category Navigation wp-navi
I am writing here because after hours and hours I can't fix my problem.
I am using a Custom Theme
I am using the plugin wp-navi
My pagination works fine.
The problem is to display categories when ...
0
votes
0answers
29 views
Adding New attribute in wordpress
I'm using Wordpress to implement the website:
The pages in my templates should be sliding vertically, so there is a 'Next' button in the end of each page. Now my problem is in the admin section ...
0
votes
0answers
48 views
Posts 2 Posts, losing connection in template parts
I am using the Post 2 Posts plugin to connect different post types. My code works perfectly when it's all in one file (archive.php). The problem I have is taht I want to split out the part that does ...
0
votes
0answers
71 views
wp_query orderby value not from meta_value
I'm using the myreviewplugin to add ratings to posts. I'm now working on the posts loop and customising the query using wp_query.
Everything is working fine, but I need to expand the orderby ...
0
votes
0answers
92 views
Advanced Search Wordpress
I am trying to create an Advanced Search in Wordpress. The advanced search form is made of 3 dependent dropdown boxes (category: type, sub-category: brand, sub-sub-category: model).
It also has 5 ...

