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

Passing multiple variables in wp_rewrite / wp_query

i need to be able to append a custom url for my page in wordpress so far i can get it to return the first query var, but i cannot get it to return the second or third im at a loss of what to try next, ...
0
votes
1answer
125 views

Query to get last posts from authors of blog

Firstly I get user with role "author". $author_args = array( 'role' => 'author' ); $authors_list = get_users($author_args); Nextly I reform array $author_list = array(); ...
0
votes
1answer
805 views

Pagination doesn't work

I created myfile.php with the following content: global $paged; if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } else if ( get_query_var( 'page' ) ) { $paged = ...
1
vote
2answers
262 views

Tell wordpress to show a single page instead of an archive

So I have multiple custom parameters in the url, and at some point when the query reaches 3 parameters (e.g. ...
0
votes
0answers
25 views

General Guidance on how to delay validation of user profile custome field

I have a concept that want to apply to my Wordpress Theme. I want to add a costume field to registration form (easy, ok) the field can be filled later in profile, but must be field in 30 days, ...
0
votes
0answers
159 views

Pagination in custom loop [duplicate]

I thought I know how to add pagination to a custom loop and I've seen these questions and tutorials: Pagination not working with custom loop ...
2
votes
0answers
42 views

How to show in search results posts with a particular tag in a particular category?

As the home page of my blog I've a static page. There I want to show the navigation of the site. Category1 Sub-Category1 tag1, tag2, tag3 Category1 Sub-Category2 tag1, tag2, tag3 ...
2
votes
1answer
400 views

JSON: schedule creation of json file

After some research I've managed to create a json file which I use as input for Twitter's typeahead (prefetch). On my website I have several hundreds of events and several thousands of artists (both ...
0
votes
1answer
353 views

Why doesn't my WP Meta Query return any results?

Is it not OK to accept a value from $_GET as the key in a WP Meta Query? I'm not sure why this code doesn't return any results... BOTH the queries for Price as well as bedrooms do not return any ...
0
votes
2answers
329 views

How to use if($wp_query->query_vars['name'] == 'pagethatdontexist') without getting a 404? How to suppress 404

i want to do something if my url is /pagethatdontexist But I dont want wp sending 404 headers. I tried this: add_action('wp', array($this,'awp')); function awp(){ global $wp_query ; ...
0
votes
1answer
65 views

Paged within a custom content type template [duplicate]

I'm having a huge problem a custom query within a custom post type template with regards to pagination. For some reason, the previous post, next post links are showing blank. If I do ...
1
vote
1answer
433 views

How to filter by custom post type in taxonomy archive pages

I have two custom types. One called "Questions" and other called "Files". They both share a custom taxonomy called "Types". Everything works fine, however if I go to the "Types" link inside my ...
0
votes
1answer
114 views

Storing query variable and then using wp_reset_query

I want to use a pagination function with a custom posts query (to get posts from a specific category). My pagination function gets the query from global $wp_query; So in the following code I have ...
0
votes
0answers
100 views

show/hide attachments

Is there a way to show/hide attachments in my case images on a post. What I want is to mark an image as "hidden" and then only show it to the admin and hide hidden images from a normal user I know ...
1
vote
1answer
98 views

Can I specify post__in for one particular post type in the query?

I want to do something like this $query_args = array( 'post_type' => array( 'cpt_1', 'cpt_2' ), 'post__in' => array( 1, 3, 5, 7 ) ); where I can specify which post type the post__in ...
0
votes
0answers
67 views

tag_slug__and not working as expected

I am trying to fetch all posts which has been tagged with particulars tags.here is code i am trying to use $args=array( 'tag_slug__and' => $categories_array, 'posts_per_page'=>10, // ...
0
votes
1answer
164 views

Multiple Query_Posts

I am trying to put a query_posts inside a WP_query. Anything after my query_posts doesn't work properly. Here is my code. What am I doing wrong? <?php $args = array( 'post_type' => ...
0
votes
1answer
99 views

How to check if a WP_Query has data

I have the following WP_Query, which works great: <h4>Frequently Asked Questions</h4> <ul class="faq"> <?php $args = array( 'post_type' => 'questions', ...
1
vote
1answer
607 views

Ajax load more button in Recent posts widget

I create Recent posts widget and i trying to create load more button for it to get more Recent posts links by ajax ,is there any tutorial for how to make it?
0
votes
1answer
82 views

Problem while filtering by 'category_name'

I have the following code in order to display a custom WP_Query: <ul> <?php $args = array( 'post_type' => 'preguntas', 'posts_per_page' => 50, 'category_name' => ...
0
votes
1answer
724 views

custom post type paging not working past page 3

I have a custom post type called services which has 23 custom posts, i also have a custom taxonomy for all the categories (5 categories). I am trying to create a list of all the custom posts of ...
1
vote
2answers
347 views

posts2posts query using connected_items array issue

My setup is as follows I hava a custom post type named 'events' and a custom post type named 'genres' which I link with scribu's Posts2Posts plugin. Each event can have multiple genres linked to it. ...
0
votes
0answers
124 views

query by meta value then date and not empty meta value

So i have a query like this function filter_where( $where = '' ) { // posts in the last 7 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-3 ...
0
votes
1answer
199 views

Show selected images on top in Media Manager

I've searched numerous StackOverflow and Wordpress Awnsers questions, but I couldn't find any solution that matches my situation or even remotely points me in the right direction. I have a custom ...
1
vote
2answers
49 views

How can I get the first 50% of all posts (within a custom post type)?

I'm trying to make a multi column layout. Seen as CSS3 adoption of column layouts is still thin on the ground, I was thinking maybe I could grab the first half of all my posts (and then the second), ...
0
votes
1answer
325 views

Query multiple meta values

I'm working on a 'checkbox filter' to query posts by checked values. See this link (EDIT: As you can see there are just 2 posts in this link, as soon as the user checks for 'MINI' it gets a good ...
0
votes
1answer
433 views

Query based on custom fields start and end date

I have a custom post type called Events, with 2 custom fields, start date and end date. These fields are stored using a timestamp in the database. I want to create a custom query based on these 2 ...
1
vote
1answer
1k views

How to create database table, add data, update and delete using wpdb via plugins?

I am just starting out to create plugins with database. I know to create a custom database when activating the plugin. I just want to know whether we can create tables at the front end like adding the ...
0
votes
1answer
277 views

Compare “Main” post ID to ID inside wp_query loop

I have a video viewing section on my site. The single post template displays a large area where the video plays and then there's a column of thumbnails representing other videos along the right side. ...
0
votes
1answer
90 views

Issue with sorting by post date and custom post type

I'm having a strange issue with sorting by post date. I created a slideshow post type and it does by default order by post date but If I change the date posted through the admin the order doesn't ...
0
votes
0answers
82 views

Orderby comment_count ignored if multiple orderby values

I'm trying to order my archive page by comment_count then title. add_action( 'pre_get_posts', 'my_change_sort_order'); function my_change_sort_order($query) { if (is_archive()) { ...
0
votes
1answer
159 views

All blog posts are not showing up

This post may already exists but I just missed it in how I searched for it. Here goes. I have recently changed my blog back to the Genesis Framework. I am using the Nameless child theme. These are my ...
0
votes
2answers
348 views

Event with multiple dates, display events chronologically

I've been breaking my head over this for days now and can't seem to figure it out (with the limited knowledge I have). I want to achieve the following: I have a custom post type 'Events'. Each event ...
0
votes
0answers
198 views

WP + woocommerce search with specific attribute

I have a problem. When I am adding a product in php code I need to check first if the product with the same code does not exists. I am using attribute in woocommerce and set new attribute code. In DB ...
0
votes
1answer
278 views

offset WP_Query by negative 1

I have an event loop and I was wondering if it's possible to somehow offset the loop by -1 so the prev and next posts of the current post are shown. --edit-- Okay thanks for your comments, my ...
0
votes
2answers
310 views

get contents and permalink from a specified page

below is a query where it supposed to get a contents from a page by a specified page title <?php $page = get_page_by_title( 'About Us' ); $content = apply_filters('the_content', ...
0
votes
0answers
13 views

One pagination with 2 queries [duplicate]

Pagination doesn't work on my site. I'm using two types of queries, like this: First query without pagination: <?php $my_query = null; /* this query for tagged posts, show last one. ...
2
votes
1answer
169 views

Access to Instance Variables from WP_Query

If I make a query to the wordpress database to pull the five most recent posts of some kind, and I would like to do a different treatment to each of them, is there a way to access the individual ...
1
vote
4answers
171 views

wordpress ajax relationship query

Using the relationship field from Advanced Custom Fields I link artists to events. Both these artist and events are custom post types. For each event, the post IDs of the related artists are stored in ...
-1
votes
2answers
7k views

How to clear the cache?

I have made changes in my CSS, but it doesn't work. I know it's because of caching from admin panel. How to clear cache of my WP admin. Is there any method to clear the cache?
0
votes
0answers
29 views

Apply operators AND or OR while passing taxonomy query vars in form multi select dropdown

I want to add taxonomy query vars to a post type archive like so: http://www.mydomain.com/?taxonomy_a=term1,term2&taxonomy_b=term1+term2 how do I control operators in query vars if I use multi ...
0
votes
1answer
37 views

confirm my booking with phone number

I have created a booking form on front-end, and there is also "confirm my booking" page. once you submit your booking form. and it stored on "booking" custom post and saved post meta (such as phone ...
0
votes
1answer
29 views

What query to append the 10 next posts?

I am loading more posts with ajax when clicking on a button. There is 4 posts when you arrive on the page and everytime you click on the button, it needs to load 4 more. What query would I need to ...
0
votes
1answer
178 views

Multiple Rows in a <table> using wp_query

I am displaying posts in a grid (4 posts wide by 2 posts high). I am using a table. In order to get the content to display on the second row, I am using two wp_queries (one on each row) because I ...
2
votes
2answers
2k views

How to print the excuted sql right after its execution

I am searching for a way by which i can print the executed sql query just after the : $wpdb->query( $wpdb->prepare("INSERT INTO tbl_watchprosite ...
1
vote
1answer
174 views

Search Custom Post Type with all meta attached?

I'm currently have a search box that's supposed to search a certain post type. It's supposed to check the query against all standard cpt content, tags and the associated meta data. I'm wondering how I ...
0
votes
1answer
85 views

Find out if request is for custom post type archive before query runs

I am writing a plugin that is modifying the RSS2 feed for a podcast that uses a custom post type. After the query runs (on action hook template_redirect; See this question for why), I'm checking to ...
1
vote
1answer
103 views

How use %like% in sql statement wordpress

i use a like %text% statement in wordpress: SELECT * FROM location WHERE name LIKE "%on" OR name LIKE "%on%" i tried anything but it's not run: $wpdb->get_results($wpdb -> prepare("SELECT ...
0
votes
2answers
618 views

max_num_pages says 4, yet I am only able to navigate to the third page

Current query: if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) {$paged = get_query_var('page'); } else {$paged = 1; } $args_main = array( ...
0
votes
1answer
126 views

Posts2Posts, wp_query and orderby issue

I've been working on this issue for several hours now and I'm stumped. The following query refuses to accept any orderby directive. NOTE: This is running on a single-cpt.php page within the normal WP ...