0
votes
0answers
12 views

WP_Query Meta_key is text value and need to sort as numeric not working

I have the following code below in my ~WP_Query`. $args[ 'meta_key'] = 'price'; $args['orderby'] = 'meta_value meta_value_num'; $args['order'] = 'ASC'; The custom field in question has historic ...
0
votes
1answer
19 views

Sorting posts by Multiple custom fields in defined order

I'm currently sorting some posts out by custom fields 'role' and 'surname', using the following: function customorder($orderby) { return 'mt1.meta_value DESC, mt2.meta_value ASC'; } $args = ...
0
votes
1answer
27 views

$args Orderby The number

I have this code $cat_args=array( 'include' => '42,210,21', 'orderby' => '42,210,21', 'order' => 'asc' ); $categories=get_categories($cat_args); foreach($categories as $category) { ...
0
votes
1answer
27 views

Custom Search Query – include only custom fields and title

I have a custom post type and I also need a custom search. I want the post title and two custom fields to be indexed/queried. I found solutions for title only and for custom fields but not for both so ...
0
votes
1answer
20 views

How to query the custom fields by language?

For each post, there is a custom field name "Function", the key/value pair is like this: Key : Functions Value : <!--en-->Nourishing Yin and invigorating the vital essence of ...
0
votes
1answer
134 views

Group WP_Query by meta_key date

I have a wp_query which lists posts from a custom post type, sorted by a custom field 'time'. I'd like to group this list by another custom field 'date', so that every post that has the same custom ...
0
votes
1answer
82 views

filter wp_query result with custom field values

I'm getting started with advanced custom fields. I have a category field (main_category) where the categories given below are selected using the radio buttons. 1. Electronics 2. Programming 3. ...
0
votes
0answers
35 views

query_posts with sorting on a custom datestamp

I have a custom meta field that I want to use to sort with query_posts but its not ordering my posts properly since it is a datestamp (i.e. 04/21/2014) and its treating it like a normal text string. ...
0
votes
1answer
58 views

Order post type by sum of two custom fields

I have a custom post type for vouchers. I've added two custom fields to this post type named "value_1" and "value_2". They both contain a number. (The first value will be applied at checkout, the ...
0
votes
1answer
48 views

meta_compare not comparing whole integer

I have submitted an integer data via a form to my custom search page. I can get values properly if the input is single char (e.g. 1 ) but if the input is multi char (e.g. 100) it still compares ...
2
votes
1answer
173 views

Custom Field sort not working (WP 3.8.1)

I am trying to sort a custom wp_query using the date format YYYYMMDD (php: date('Ymd') ). This will not be regarded as date field, but rather as a numeric one stored in custom field. My WP-QUERY code ...
0
votes
1answer
281 views

WP_Query and two custom fields returns no posts

Having trouble with WP_Query returning no posts when filtering on two custom fields, although testing for each custom field individually works perfectly. After reviewing documentation for custom field ...
0
votes
1answer
39 views

query post based on comparison

Each post in my site can be rated as 'good' , 'ok' , 'bad'. The values are stored in custom fields. I now need to show top 10 posts with maximum 'good' and it should not display posts with greater ...
0
votes
0answers
65 views

Query posts filter not working

I have created one custom post type which name is villa. In this post type I have added five post and assigned custom field values(mention bellow): Post Name Assigned Fields 1. Chalet ...
0
votes
2answers
270 views

WP_Query get posts where post_name is empty

I want to get all the posts for which the post_name(slug) is not set/empty as well as a meta_key does not exist. $args = array ( 'post_type' => 'books', 'name' ...
0
votes
1answer
39 views

Meta query relation 'OR' not working as expected

I have the following query, $the_query = new WP_Query( $args );, which is supposed to show any properties of H_property_type bandb, hotel or dining. If I do a print_r of $args I get the following, ...
0
votes
2answers
41 views

Storing/querying custom date data

I'm currently building a site where I need to filter/order/query a custom post type by date data. I can't use the post published date for this, but can't decide what would be the most efficient way to ...
0
votes
1answer
112 views

Order posts by separate menu order for different sub-categories

My scenario is as follows: Categories: 1. Category A - Sub-Category A1 - Sub-Category A2 - Sub-Category A3 2. Category B - Sub-Category B1 3. Category C 4. Category D The ...
0
votes
1answer
120 views

Adding Custom Fields to Search

I'm trying to add custom fields to my search so that it can be refined by meta values. Currently I have added some select lists to my normal search: <form role="search" action="<?php echo ...
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
0answers
307 views

WP Query multiple select form - meta_query help

I am creating a multiple filter - as in I could filter by all the options if I wanted to do so, i.e terms, calories & price in my case. I am having trouble with meta query args. At present I can ...
0
votes
1answer
171 views

Show Posts in Vertical Tabs with Scrollbar

I have created CPT ( Custom Post Type ) called Recipes. I want to display all me recipe in Vertical Tabs. For Example; check the image below i have created. Image Example Click Here On the left ...
0
votes
0answers
74 views

WP_Query with intersection of post meta field and user meta field

On the site I'm building, each post has a serialized array of strings. Let's say post ID 1234's value for my_site_teams is array( 'Chess', 'Cheerleading', 'Football' ). Each user also has a ...
0
votes
1answer
132 views

How to get specific post meta by title or id

I have register bellow custom post type in function.php and I am using Advanced Custom Fields. Using advance custom field type I have added one image field and assigned to my Release custom post type. ...
0
votes
1answer
127 views

Compare WP Custom Field date

I had create a custom field "date" with this format 16/09/2013 (d/m/Y). How can i compare date and show only post with date from today ? This is my query that don't work !! $args = array( ...
0
votes
1answer
70 views

How to Order Posts by Custom Fields?

Can someone tell me why this is not working: $args = array( 'cat' => '2,39,30', 'orderby' => 'title', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' ...
1
vote
2answers
336 views

How do I search an array stored in a custom-field using WP_Query?

I have a custom post type called "on-air" that included a custom-field called "daysonair". The form for this has checkboxes for each day of the week. When you add/update a post, the checked items ...
0
votes
0answers
71 views

Course listing with multiple dates

I'm trying to build a course listing (custom post type) - each course has multiple dates assigned to it, but I'm failing miserably (mainly due to my poor PHP skills!). I'm trying to use standard ...
1
vote
0answers
90 views

Possible to filter custom post type with multiple meta data?

I'm wondering if it's possible in one loop to accomplish what I need to do. What I would like is to sort all custom post types by the meta data of county and put them in order which it is doing here. ...
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
2answers
481 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
191 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
31 views

The best way to collision check in WP

E.g. I have a random number generated by a PHP code $random And I need to make a check if this number doesn't exist in any of my posts in DB in my meta field called unique_code What is the ...
1
vote
1answer
328 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
1
vote
3answers
66 views

Multiple relationships in a query

I’m researching a bit WP_Query and me a problem has arisen. I have custom fields in tickets and would like to make a WP_Query showing this (put an example): (field1 = “data1″ AND field2 = “data2″) ...
0
votes
1answer
139 views

WP_Query based on multiple metadata comparisons

I have created a custom post type with custom fields and I need to filter them based on several meta data values. $args = array( 'post_type' => 'match_report', 'post_status' => ...
0
votes
1answer
135 views

Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

I have a post type that holds a custom meta field with a date in it. The date is stored in the format: yyyymmdd. On the archive page for this post type I want to create 12 separate containers, one ...
0
votes
2answers
103 views

meta_value and meta_key filtering returning no posts [closed]

this might sound like a very stupid question, and I am almost ashamed to put it here... however, after using the code straight from wp codex, and trying a couple of other variations from googling ...
0
votes
1answer
253 views

WordPress Meta Query: Relation is not working correctly

I make a custom search box and let user do search. I have added required field to my editing panel by custom meta box. I have a post which have some meta data like London as place and 13021 as post ...
0
votes
1answer
1k views

2 orderby in wp_query with 2 custom fields

I'm triyng to display hotels (taxonomy which i have created) by two 'orderby' with wp_query but i'm not success. Results looks likes: Hotel 1 : 2 persons 5 stars Hotel 2 : 2 ...
0
votes
0answers
133 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
129 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 ...
1
vote
0answers
527 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
1answer
1k views

Custom query with category exclusion and post-meta “whitelist”

I have two widgets, one shows News while the other shows everything except News (We'll call the second one Blog). The blog portion is currently working correctly. The News posts are either ...
0
votes
1answer
913 views

Filtering a WP_Query meta_query by numeric values isn't working

That was a very dense title. I have a custom post type "event" which has a Date/Time picker field "event_date" thanks to the Advanced Custom Fields plugin. This Date/Time picker saves a UNIX ...
2
votes
1answer
1k views

WP_query : meta_key with custom rule for specific value

I'm a bit stuck with a WP_Query code. Here it is : $args = array( 'post_type' => 'post', 'meta_query'=> array( 'key' => 'karma', 'compare' => '>=', ...
0
votes
0answers
277 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
1answer
77 views

404 on Pages for Custom Post Type & Query_Posts

It took me quite a while to find a good solution for ordering a custom post type by two custom meta keys. When I finally got it working, I found out the pagination no longer works. I've tried dozens ...
0
votes
1answer
262 views

WP_query multiple custom fields not working

I am currently using WP 3.1 and trying to get WP_QUERY to work with the custom fields. My argument is as follows: $args = array( 'post_type' => 'post', 'meta_query' => array( 'relation' ...
0
votes
1answer
106 views

Cache issue with WP_Query and custom field filtering

I have three separate WP_Queries on a page. Each of them return custom post type items that have a certain checkbox checked and then display one of those randomly. The checkbox has been added using ...