A generic term referring to the process of retrieving information from a database.

learn more… | top users | synonyms

0
votes
1answer
434 views

Load more posts with multiple queries

I've been developing a theme which uses the load more ajax plugin, everything is setup and working great with the main query. But, once I setup a new query for popular posts, the load more posts ...
1
vote
1answer
490 views

WP_Query: query posts by ids from array?

I did quite a bit of research but can't figure why this wouldn't work for me? echo print_r($rel); // Array ( [0] => 63 [1] => 87 ) $args = array( 'post_type' => array( 'post' ), ...
0
votes
2answers
1k views

SQL query to get posts from multiple categories but not in a category

I need to get the last posts' ID and the post_tile within categories 1 and 2, and exclude those within category 3. It must be SQL, because if I use WP_Query it retrieves too much info and I only need ...
0
votes
1answer
106 views

All in one calendar custom post type query doesnt work as expected

I did a custom post query for AIO Events Calendar, as described here: All in One Calendar Plugin Custom Post Type Query But it doesnt work. <?php echo esc_html( $event->cost ) ?> returns ...
1
vote
1answer
841 views

How to query a custom post type with a taxonomy filter but display post type archive page?

I'm filtering the main query of Jigoshop with my own taxonomy with this hook (The file responsible for Jigoshop queries that I'm hooking, Jigoshop hooks onto WP 'request' filter): add_filter( ...
1
vote
1answer
261 views

Show how many images are attached to a post/page on compose page

On the front-end, I'm using a query to show all attachments attached to the current post. However, on the compose page, there's no way for a user to see how many images are attached without opening up ...
1
vote
2answers
157 views

Query reset problem or flawed code to enable custom post type query

After reading through here and trying various options, I am finally able to get my custom post types 'testimonial' (created with product 'Toolset') to show along with my standard cat/tag queries ...
0
votes
1answer
980 views

wp_get_post_terms Order by not working

wp_get_post_terms Order by not working My code is here query_posts(array('post_type' => 'product','post__in' => $product_ids,)); while (have_posts()) : the_post(); global $post; $args = ...
0
votes
2answers
1k views

Setting get_queried_object

I know that get_queried_object contains the object that was queried for the current page. My question is, what methods of querying affect the contents of this? For instance: query_posts get_posts ...
0
votes
1answer
53 views

Creating pages and getting their values from the database table

I need to make inquries from my new website. I want to know whether Wordpress is capable of this: Say it I have such a table: CREATE TABLE IF NOT EXISTS `mytable` ( `id` int(11) NOT NULL ...
0
votes
1answer
53 views

Adding Category Argument into an Array for WordPress Query

I'm new to customizing WordPress and am looking to query an array of posts within a certain category. I have a display that's showing an array of all posts from the site: $arguments = array( ...
0
votes
1answer
73 views

Filter multiple different main queries on custom pages

Ok so I have multiple different page templates with a main query that I want to filter the loop for. In my example I try to use a function to filter the main loop of my site and also the main loop for ...
0
votes
2answers
256 views

Get all custom post types excepted some…

I stack since a few hours now and I'm sure that this is not so complicated. I would like to get all custom post types into this $posts = query_posts( ...
0
votes
1answer
93 views

How to solve this without flushing the rewrite rules for each post query the visitor triggers?

Actually I have the problem that I provide a menu link (predefined in theme) to the latest post of a specific custom post type. I achieve this by the following function … function ...
0
votes
1answer
95 views

Help with Related Posts Function

I'm trying to write a function that will grab all related posts according to the term of a taxonomy. I'm having trouble though trying to query multiple terms. The way I am doing it right now is using ...
4
votes
2answers
192 views

Rearranging posts based on categories

Hey everyone on Stackexchange! I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date ...
0
votes
2answers
136 views

Query custom post type based on post id and custom field value

There might be an answer here somewhere, but I'm unable to find it, or recognize it if I did. Here's the situation: I have a custom post type, 'region', that displays on single-region.php. Region ...
0
votes
1answer
1k views

query posts and custom post type with meta key

I'm trying to query all-in-one-event-calendar's custom post type ai1ec_event and normal wordpress posts in a slider on my home page. That works pretty well. Now I want to query only the posts with ...
0
votes
1answer
241 views

Add query string variables to all hyperlinks URL matching a specified domain

This is my case. Supposing in my plugin dB table I have the following stored field name and values: argument_1= 'test' argument_2= 'test2' And I want to add a new string query string variables to ...
3
votes
1answer
157 views

How to query for a week using key => value WP_Query argument notation?

I would like to be able to query for a specific year and week using WP_Query argument notation. I am using this notation as I would like the page to paginate. What's the correct "year" and "week" ...
2
votes
1answer
1k views

Page navigation doesn't show when query category

Problem: when I do www.example.com?cat=4 or choose category through custom menu or from category widget it shows only first page without navigation at the bottom, where it supposed to be. It's the ...
2
votes
2answers
365 views

Remove Unnecessary Mysql Query

my single posts is getting 31 query from mysql. I checked all queries. I saw this query. I am using last posts and categories widget. I think there query is unnecessary.How to remove theme Query: ...
0
votes
1answer
54 views

Make division in post_query?

I am new to both PHP and WP so I am struggling with one thing: I want to fetch all my post and then order it according to my meta-value "_mycounter" divided with the date in seconds from 1970 or what ...
0
votes
1answer
209 views

Counter code for paginated category pages in wordpress

I am trying to customize the category template whereby I wish to show the ordered list of 10 posts on each page. I am using the following code in the loop: <?php $counter = 1; ...
0
votes
2answers
141 views

Custom MySQL query to list post

I have the following query: SELECT p.* FROM orders_items oi INNER JOIN products pr ON pr.`post_id` = oi.`product_id` INNER JOIN posts p ON p.`ID` = pr.`post_id` AND p.`post_type` ...
2
votes
3answers
775 views

Remove [gallery] shortcode altogether

I used remove_shortcode('gallery'); ...the gallery is gone, but the shortcode is visible in the text. How do I remove sitewide? I've searched for sql queries, but no solution fixes my specific ...
1
vote
0answers
116 views

Changing status of Published posts which have less Content to “Draft”

function draftpost(){ global $wpdb; $prefix = $wpdb->prefix; $wpdb->query("UPDATE ".$prefix."posts SET post_status='draft' WHERE LENGTH( post_content ) <500"); } ...
0
votes
0answers
7 views

is_single query calling the wrong stylesheets? [duplicate]

Possible Duplicate: is_singular won’t call my functions? So I am trying to call different style sheets for each of my post types single page. Here is the code I am using in my header ...
1
vote
1answer
1k views

Custom search page and search by title, content and tag

Can someone review my code , I need to know better solutions or any bug. Okey ! , I made a PHP file to get search results by parameters and search by title , content and tag PHP's head look like: ...
1
vote
1answer
434 views

Recreating the hierarchy of taxonomies for a dropdown form menu?

I have a form that contains a dropdown menu. This form is on a page form.php and is not part of my theme. It exists outside of my site. This dropdown menu contains my list of values for a custom ...
0
votes
1answer
143 views

How to limit post query to only return a total count of items with certain post statuses?

I have a couple functions that are creating an admin table to display on my custom dashboard page. I'm having a little trouble with the function that determines what pages to display because I'm not ...
0
votes
1answer
687 views

Displaying Portfolio Filter by Category Order (alphabetically)

I have created a custom post type to display churches in Europe. I used this tutorial to make it filterable: http://wp.tutsplus.com/tutorials/creating-a-filterable-portfolio-with-wordpress-and-jquery/ ...
0
votes
1answer
981 views

WP_Query ordered by custom field that is a date string?

Each of my posts have a single custom field that is a string of a date (not the date of the post). Instead of my theme's current query, which orders by published date, I want to order by this custom ...
3
votes
2answers
238 views

Very slow query

This query works, but it takes upwards of 20 seconds to run on a Quad Core dedicated server... How can I optimize this? $slides=get_posts( array('post_type' => 'any', 'numberposts' => 5, ...
0
votes
1answer
120 views

Custom Query Arguments

I want to run a query base on the following $args. My question that how to pass variable number of arrays to tax_query as currently i have two arrays within tax_query it can be 1 , 3 or 5 and so on. ...
0
votes
1answer
193 views

Why posts array is empty?

I try to get posts that either do not have a custom field set or if set have a value not like a given parameter. Here is my code: $args_included = array( 'numberposts' => 1, ...
0
votes
1answer
65 views

How do I find users by password?

I need to add a passkey to each user, so I decided to just giving the user password that value and use WP functionality to store it/retrieve it. So now I need to find what user that password belongs ...
0
votes
1answer
76 views

Display old posts if no future posts exist

I have a loop setup to display future posts but would like to set up an if statement where if there are no future posts, it will show a certain amount of published posts. My current query below: ...
0
votes
2answers
925 views

Using dynamic conditions in 'posts_where' filter

I have the following code which gives be posts that are published in the last 100 days function smbd_cats_by_days ($where = '') { $where .= " AND post_date < '" . date('y-m-d', ...
0
votes
1answer
335 views

WP_Query meta compare must include ALL array values

I am allowing users to query posts using a form with checkboxes. I want the posts to be filtered by the checkboxes but instead of showing all posts that include the ANY of the meta values selected I ...
0
votes
1answer
1k views

Get 1st parent category id from post

I have this structure for my categories: Issue 4 - News - Supporting our troops - Breaking news <?php $category = get_the_category(); $parent = ...
0
votes
1answer
76 views

why the current date do not update

I'm using the following query to update fields in my table if token is matching, but the current date is not getting inserted $this->wpdb->update( 'wp_competitors', ...
0
votes
1answer
73 views

Get WP_Query query after execution?

It it possible to get the configuration of a the latest called WP_Query? I need to use it for debugging. For example, if i run something like: $the_query = new WP_Query( $args ); ... Could i get ...
2
votes
1answer
782 views

How to List Events by Year and Month Using Advanced Custom Fields?

I have a custom post type "Kalender_item" with a custom Date Field (YYMMDD). I want to list all the posts on a page sorted by Year and Month. For example: November 2012 (all events that occure ...
2
votes
1answer
218 views

List the 5 most recent child pages

I created a hierarchical custom post type for a gallery. The parent pages are the galleries and the child pages are the albums. I want to display the most recent albums on my sidebar (so basically the ...
0
votes
3answers
306 views

How to check the array values, what WP_Query has brought to me?

I have two questions in a row: How to check the array values, what WP_Query has brought to me? If I get 10 posts in cat=3, then I want to get only 5 from them, and then want to echo them ...
0
votes
1answer
193 views

How do I sort multiples pages?

I want to use a dropdown to sort a list of posts in WordPress. The results will display on multiple pages. So how do I pass the query on to the second, third, fourth, etc. pages? Here's an example of ...
0
votes
1answer
147 views

Restrict query to last day with posts

I am using the Delicacy theme. I want to show n my homepage the posts of the current day. But if there are no post for that day it shows "No found". I want to show posts from the last day with posts ...
0
votes
1answer
84 views

List related terms + taxonomies

I have a set of main categories for a set of products. All these products has additional taxonomies associated with them. On a product category page, is there a way I can get all terms in use for ...
0
votes
2answers
878 views

wpdb update multiple row?

I need to change the meta value of all users at once. Seem there are no api for this,except using custom database query. This is my code: $matches = array('meta_key' => 'user_token'); $data = ...