"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
7 views

Use REGEXP in WP_Query meta_query key

I know I can use REGEXP in WP_Query like this: $query = new WP_Query(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( ...
1
vote
0answers
8 views

How do I create an archive page for standard posts?

I've been tasked with creating a portfolio website for a client who also wants a blog. What I've Done Thus Far: I’ve created a custom post type to separate the portfolio work from the blog posts and ...
1
vote
1answer
15 views

Not getting metavalue

I want to get meta value through meta key. Here is my code: $sqlMonth = mysql_fetch_array(mysql_query("SELECT meta_value FROM wp_usermeta WHERE user_id = " . $user_ID . " AND meta_key = 'month'")); ...
0
votes
0answers
9 views

WP query with bootstrap carousel

Under this jsfiddle you can see typical bootstrap carousel: http://jsfiddle.net/juddlyon/Q2TYv/10/ And its working properly. But what i wanted to achieve is to: - have carousel which displays same ...
0
votes
1answer
22 views

Using Cookie Data For WP_Query Loop

I'm trying to retrieve data set in a cookie and use this to run a query. I've set the cookie in functions.php like so; add_action( 'init', 'resultsCookie' ); function resultsCookie() { ...
0
votes
0answers
20 views

Saving Query Data & Using On Subsequent Pages

I have a PHP form that uses GET to send vars to a URL and return specific products in WooCommerce. Within the loop, I already have a piece of code to collect each product ID result. What I now need ...
0
votes
1answer
44 views

Mathematical operations on custom field values? (updated)

I'm attempting to write a function, run by a cron schedule at midnight every night, that will subtract 1 from the integer value of a custom field. It will function basically as a countdown timer for ...
0
votes
1answer
19 views

Filter user list that meta_value is empty

I am trying to get all users that meta value is empty so i tried many variations and cant get the list of all user that birthday field is empty (not set). ...
0
votes
1answer
39 views

Sort users by “birthday” using WP_User_Query

I have created user meta that holds user birthday (birthday). birthday is date field. Now i am trying to figure how to sort (get) all users that have birthday based on specific month. I have ...
0
votes
0answers
13 views

Ultimate Wordpress Query Search Filter plugin Results page id?

So, I am a Wordpress Novice(not even a Beginner) and I just started using Wordpress around two days ago.It seems I am already stuck on a problem. I am using a plugin called Ultimate Wordpress Query ...
0
votes
1answer
22 views

get all remaining posts after a partcular post id

We all know and its easy to get posts using wp-query. We can filter, orderby etc. I am in a situation, i would like to get all remaining posts after a post id, say 100. So what i need is to get all ...
2
votes
1answer
27 views

How to order by post_status?

I'm using get_posts() like this: $posts = get_posts(array('orderby' => 'post_status')) which is not possible cause it's not in the allowed keys in the parse_orderby() method How to get around ...
0
votes
0answers
13 views

How to list posts of a given format

I want to create new urls in my wordpress that list posts of a given format and category. I thought the url structure would make sense to be like this: /[post-format]/[category], i.e.: ...
0
votes
1answer
48 views

Related posts with WP_Query

I'm stuck with the related posts querying. I need the related posts to be displayed with any depth from the main parent. I have the following structure categories on my website: - Category level 1 -- ...
0
votes
1answer
20 views

WP_Query with meta_value LIKE 'something%'

I have read several questions like this (for example, this), but no equal. I WP_Query need to perform a LIKE on a meta_value. My problem is that I want the like is as follows: meta_value LIKE ...
0
votes
1answer
17 views

Wordpress Prevent 404 on missing custom post

The thing I am trying to achieve is to get data from a third party data source and display each piece of information as if it was a "post" in a WP theme. Now, the WP theme intrinsically works with ...
1
vote
1answer
31 views

How to connect two custom post types with nested loops

I have 2 custom post types created: "classes" and "teachers". I have created using Advanced Custom Fields plugin a field for "classes" custom post type, a multiselect that helps me add certain ...
1
vote
1answer
16 views

Display custom tags on pages that have a specific page parent

I would like to use Using the WP_Query or Query_Posts method. I'm currently using the query_post method. $terms_array = array(); if ($strurl == "somesite.com"){ $resparent = "18219"; //Page ID ...
2
votes
1answer
51 views

Ignore/Skip default value on orderby menu_order?

Is there a way to query all pages and order them by menu_order but ignore those pages that the default value of 0? I was trying to do something like this: $the_query = array( ...
0
votes
1answer
26 views

Modifing archive query affects show post count function

I'm trying to modify the archive query of archive page with this function hooked to pre_get_posts action hook. // Load our function when hook is set add_action( 'pre_get_posts', ...
-1
votes
0answers
21 views

BSI Car Rental System not working with Theme

On this page: http://www.londonautomotive.net/vehicle-hire/ Getting the following error when trying to book a car hire: Warning: trim() expects parameter 1 to be string, array given in ...
-1
votes
0answers
17 views

Pagination pot showing

I have the following code listed below, where I reset the post data after words, I have tried resting the query data and the pagination still doesn't show. I have even tried to set, in the Reading ...
0
votes
0answers
22 views

Pagination on page.php with wp_query and query_posts

I'm trying to get pagination to work on a custom page.php and this has been kicking my butt... here is my site Here is my code: <!-- Page Blog Body Start ...
0
votes
0answers
7 views

pagination not working on page template

I am having a custom page for displaying community posts, where i want to display the posts posted in last 30 days sorted in desc order by meta value of post views which has to be greater than ...
-1
votes
0answers
14 views

Anyone know how to create comparison table with filtering? [closed]

The thing that I want to do is something like this: Comparing product features The visitor want to compare two product at the one time: iPhone 4s Vs iPhone 5s --> will show up 2 table side by side ...
0
votes
1answer
29 views

WP_Query - Accessing MetaValue from Query Result

Have this code. In doing a var_dump the meta_value is being retrieved under public object meta_value. I'm trying to access this data in a "WordPress" away instead of a more traditional PHP way. What ...
0
votes
1answer
24 views

Adding a parameter to the default query

I'm using ACF to create a "Featured" post section of the index.php and I'm having trouble then excluding that post from the main query. <?php $tmp = $posts; $isPaged = ...
2
votes
1answer
46 views

Changing Posts Per Page and offset with pre_get_posts

I have a filter using pre_get_posts to change the number of posts per page from 4 on the news landing page to 8 on all other pages (page 2, 3, etc). However I don't seem to have got the offset ...
0
votes
0answers
25 views

How to query and group posts by category?

/* * Loop through Categories and Display Posts within */ $post_type = 'post'; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies( array( ...
0
votes
1answer
41 views

WP_Query based on URL parameters

I'm looking for some help in creating a query based on fields I made in Advanced Custom Fields. I'd like to create a query that would loop through a custom post type, using arguments such as: ...
0
votes
1answer
22 views

How to add multiple custom URL variables?

I am building a Wordpress plugin that looks for different custom variables in the URL. The way I am able to achieve that right now is with this code: function add_custom_query_var( $vars){ ...
0
votes
1answer
27 views

Using tax_query to get single post per category

I have a list of magazines I need to categorize and sort. I have created a custom post type and registered a custom taxonomy to organize them. Category Structure: Print Magazines (parent category) ...
0
votes
1answer
45 views

Get pagination working for custom loops within page templates

I've got a custom loop for which I'd like pagination. The codex and examples I've found online indicate that I should get pagination as long as I pass the 'paged' query variable into the loop as the ...
0
votes
1answer
46 views

Custom post type and custom taxonomies display

I have the following CPT and Taxonomy in my WP: CPT: magazine Hierarchical: true Has Archive: true Custom Taxonomy: authorname (Magazine Author. Not the same as WP Author) Attached to: CPT ...
0
votes
1answer
19 views

WP_Query for CPT with filter by another WP_Query

I'm working on a project have 2 CPTs: Projects Units Every Unit has a meta value containining the id of Project Every Project is assigned a custom taxonomy named Regions Now I need get all Units ...
0
votes
3answers
83 views

Order By Multiple Meta Fields

I have two custom fields: meta_key1 is boolean (0 or 1). meta_key2 is a date value - 20150623 for example. Not all meta_key2 fields have an explicit value. It looks like their being treated as an ...
0
votes
1answer
15 views

Sort / Filter Queries

I'm working on a website, that showcases products, and now I'm working on the query part. Basically I want to have one page, that displays a list of products as a normal query, and then on top of the ...
0
votes
0answers
24 views

WP_Query search by meta tags shows all results everytime

I'm using a search form with WP_Query to refine results of some custom post type. It's working well if I search by items but not with text input with . It shows all results: Code for the search ...
0
votes
0answers
11 views

Trending Tags based on post views

I'm looking to display a list of the most trending tags on my wordpress blog - based on views that the posts within these tags have had, with a max tag count of around 10. I've looked into the ...
-1
votes
0answers
42 views

Woocommerce custom taxonomy query pagination

I'm using this custom query on archive page for Woocoommerce taxonomy to list all products and it works: // Retrieving current page number $page = (get_query_var('paged')) ? ...
0
votes
0answers
23 views

Filtering loop by query string in select option (custom field)

I'm trying to filter out some posts on a page template by a custom field. I could be attempting to solve this problem the wrong way - but I think a query string would be best here. Please advice if ...
1
vote
1answer
42 views

All sticky posts are returned in custom query

I have the following code: $recommended_args = array( 'post_type' => 'post', 'posts_per_page' => 3, 'post__in' => get_option('sticky_posts'), ...
0
votes
1answer
22 views

WP_Query with offset and 'orderby' => 'rand', offset not working

I have the following situation: on my index.php I am showing the most recent 20 posts using WP_Query(). On the same page in another section I would like to display 3 more random posts from the archive ...
0
votes
1answer
26 views

Creating a Tabbed Widget

I have setup my widget to retrieve data from custom post types. I am using WP Query to show the data, but it still not showing. I have also setup the file in a gist for easier lookup ...
0
votes
1answer
33 views

WP_Query with custom post type search showing all results every time

I'm working on building a search form for some custom post type. Problem is, the search yields the same results every time, which is all posts of that custom type. Please advice: Code: Search form: ...
1
vote
1answer
54 views

Duplicates with WP_Query loop

I'm showing on my front page only posts with featured image. My problem is that on every next page load I receive the same results aka getting duplicates. I'm using ordering by custom field. Any ...
1
vote
1answer
47 views

Display only posts with thumbnail using WP_Query

I'm having hard times with showing only posts which have featured images using the loop. My PHP level is basic and any help will be really useful. So basically this is my original code : if( ...
0
votes
0answers
21 views

Add search box in Bootstrap slider carousel

I'm using the Wordpress theme 'evolve' which uses a Bootstrap slider on the front page with a 'Learn More' button on it. How do I add a search box instead of the 'learn more' button which will ...
0
votes
1answer
21 views

Custom loop - Isolating post meta output depending on current query taxonomy terms

I have started constructing is a page to display a series of products based on certain criteria. Each product is part of two separate taxonomies, one for brand and one for product size (each product ...
0
votes
0answers
52 views

423 queries in 6.098 seconds

For a few months now, i'm facing a lot of difficulties with one of my websites being too slow and i'm guessing the reason behind this could be the number of queries. At the moment these are the ...