0
votes
0answers
48 views

Query Distinct Taxonomies of Custom Post Type

I have a custom post type called "coupons". These coupons can then be drilled down by "city". City is a custom field that is defined for each individual "coupon". I am then trying to modify a sidebar ...
1
vote
3answers
1k views

Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title

I'm working on a custom taxonomy term page template where we want the items that are connected to the term sorted by a publication date (custom date field) - and if there are multiple items on the ...
0
votes
2answers
45 views

Help setting up a sql query

I need to list out specific custom field items that contain an associated custom field entry. For example, the custom fields are named "type" and "food". I would like to list out all of the breakfast ...
4
votes
1answer
351 views

What is the advantage of the wp_options design pattern?

As we all know, a design pattern that is used frequently in Wordpress' DB code is the idea of persisting data for a particular object (blog/post/comment), indexed with a particular name or key. We ...
0
votes
2answers
219 views

Custom Query based on custom field of a single post

I have posts which have a custom field date in the format yyyy-mm-dd. What Im trying to do is list all the posts for a specific year on the side of a single page based on the year in the custom field ...
1
vote
1answer
866 views

Get multiple custom field values in a $wpdb query [duplicate]

Possible Duplicate: How to query posts based on lat-lng coordinate as post meta? I want to create a $wpdb query that select the closest places (custom post type) near the current ...
0
votes
1answer
997 views

$wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?

I have a custom post type 'event', a custom meta field 'event_date' and a custom taxonomy 'locations'. I want to query $wpdb to retrieve posts in this way posts must be of the 'event' post type ...
0
votes
2answers
118 views

Build index page from custom fields

Im starting to delve deeper into Wordpress custom fields and wanting to replicate this page in Wordpress: http://www.clubsact.com.au/corporate/index.php So my site is not tightly structured to a ...
3
votes
3answers
2k views

SELECT max(meta_value) FROM wp_postmeta WHERE meta_key='price'… stops working when value is over 999

Overview: I am not trying to return a post. I simply want the single highest value for a particular meta_value across all posts... just the value itself. Details: I have added a custom meta_key ...
3
votes
2answers
3k views

Retrieving custom fields with $wpdb->get_results

I'm trying to use $wpdb->get_results to retrieve an array of all posts including custom fields. I can retrieve the meta_key and meta_value columns like this: [meta_key] => state [meta_value] ...
0
votes
2answers
268 views

wpdb function insert doesn't work

It just won't insert anything, if I echo it, it will show everything fine, but it won't insert anything in database. The table name is correct. Code - global $wpdb; $meta2 = ...
2
votes
1answer
926 views

How to filter a dd/mm/yyyy date from a custom field in a query

I'm trying to build a query in order to sort some posts by a date custom field, where the dates are formatted dd/mm/yyyy. It works by querying the database directly with get_results like in this ...