3
votes
1answer
30 views

Order by meta_value_num DESC and meta_value ASC on WP 4.0

I have created a custom post type that I want to order by custom-field-1, which is boolean so its value is either 1 or 0, in DESC order (1 to 0) custom-field-2, which contains text and is supposed ...
0
votes
1answer
18 views

Comparing 2 Decimal Numbers from custom fields and displaying posts

This is really confusing me. Hopefully you can help me. What i want to do, is search for a number and display anything that is either minus 1 or plus one of the search result. The numbers that it will ...
0
votes
1answer
27 views

Display custom field meta outside loop, site wide

I've created a custom field ("breaking") with the goal that whenever one post has this field present, it will display the value in the header throughout the site (that is, all posts, pages, archives, ...
0
votes
2answers
18 views

How to dynamically attach pictures to a carousel

I am trying to make single pages for each individual portfolio piece. I created custom posts & field types, but it only seems to allow one featured picture per post. Should I be adding my pictures ...
1
vote
3answers
40 views

Categorising search results based on Custom Fields

I have two sets of posts - some have a Custom Field (true/false). So the ones which have a Custom Field (for this, let's just call it custom_field) value of true, go in one set, and the others (the ...
0
votes
1answer
86 views

Selecting posts older than the current Unix epoch timestamp

I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate custom fields. $args = array( 'post_type' => ...
0
votes
1answer
46 views

new WP_query using custom fields

I am trying to query child posts from two parents (that part is working fine), ... but now I want to exclude posts that have a meta_key of 'feature' with a meta_value of '1' Using the Codex ...
0
votes
1answer
54 views

Order posts by date and then by custom field

I am trying to do something like this one. Ordering posts by day (not time) AND meta value I want to list blog posts ordered by date (not time) and then within that day, I want to sort them by custom ...
2
votes
1answer
61 views

Meta query with string starting like pattern

I have a custom WP_Query with the following meta_query: $meta_query = array(); $meta_query['relation'] = 'AND'; if(!empty($postcode)) { $meta_query[] = array( 'key' => 'postcode', ...
0
votes
1answer
88 views

WP_Query on custom post type not displaying, multiple loops & get_template_part

I'm having problems getting my testimonials to display. On page.php I have a testimonials section. So I have a loop that grabs the content for page.php, and then a get_template_part('content', ...
0
votes
0answers
27 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
34 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
30 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
103 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
27 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
273 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
116 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
39 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
81 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
63 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
212 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
368 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
40 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
69 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
366 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
41 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
43 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
124 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
151 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
2k 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
347 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
199 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
85 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
147 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
154 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
78 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
422 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
74 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
94 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
2answers
549 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
220 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
392 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
69 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
149 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
141 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
111 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
265 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
2k 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
135 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. ...