0
votes
2answers
22 views

How to exclude post from being queried based on custom meta value

I am building a reviewing system for user-submitted posts on my website. I have a page called page-review.php which displays the oldest post of the "pending review" category. This is to ensure that ...
0
votes
0answers
63 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 ...
0
votes
0answers
36 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
61 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
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
2answers
51 views

WP Query - Is this correct?

Trying to debug, getting headache so I want to ensure that I have placed the query args in the correct place. I want to sort/order all my posts based on "myvalue". if ( have_posts() ) : /* Start ...
0
votes
2answers
458 views

Filter archive.php by custom meta

I"m trying to filter an archive page by custom meta query. I've tried using query_posts($args) prior to the loop, but it returns nothing. Any ideas? Here's what I have so far: <?php ...
0
votes
1answer
155 views

Return category slug / title from category ID

I have a custom field set up that returns the category ID of a chosen category, I'm looking to use this category ID to show, in one instance: category slug, and another instance: category title. The ...
1
vote
1answer
47 views

How can I sort homepage by a meta value?

I am trying to sort my home page posts by a custom meta value. I've been told I should use pre_get_posts but I seem to not be implementing it correctly. This is what I am doing: ...
0
votes
1answer
180 views

How can I change the publish date based on a custom field?

How can I change the publish date based on a custom field? Author uses a date picker to choose the date for journal entry. The date is used to make a list of all the users journal entries. I can ...
1
vote
1answer
146 views

Change order of posts

I made a post recently that did not explained myself right! Come again, but with better explanations. I need the "Select Option" change the order of query_posts. My current code is: <select> ...
0
votes
1answer
318 views

Transfer taxonomy to custom field

I have a blog with movie critics and I'm using many taxonomies to add some informations about the movies, like director, actors or it's year. Using taxonomies is really useful to display all movies ...
0
votes
1answer
88 views

Checking if field is set before comparing with meta_query in query_posts?

I have a query set up to compare the start and end dates for some custom fields. The start date is required for the post; however, the end date is not. This causes some issues with the following: ...
0
votes
1answer
180 views

Display Posts Query with IF function

I'm writing a template to display my custom posts types in a list. But I only want to have the post show if it has a value for one of my custom fields. I'll explain: My custom post type is "Faculty ...
2
votes
1answer
279 views

order by meta_value serialized array

Hi I'm trying to pull posts using the wp query. Just one problem--I am trying to sort the posts alphabetically by a certain meta_value. Thing is that this meta_value is a serialized array. Is there an ...
1
vote
1answer
270 views

Getting movie and serial on actor page

I'm building a cinema site, I came with a problem, let me explain: Movies- are stored in Post's Actors- are stored in Post Type - persoane ( taxonomy= lista) Serials - are stored in Post Type - ...
1
vote
1answer
132 views

Show 1 post and after a specific date show the next one

I used the following query to have only 1 post published on the homepage from a particular category: <?php if ( have_posts() ) : ?> <?php ...
2
votes
2answers
180 views

Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]

I am currently trying to perform a custom query on the authors page (author.php). I have two custom fields for posts that I want to query against (post_photographer and post_videographer). What I am ...
1
vote
1answer
242 views

meta_value_num sort glitch

i have a custom query, and I have a meta key that contains a sequence number: 1.1, 1.2, 2.1, 2.2... 11.1, etc the problem occurs when the numerical sequence gets in to double digits, ie. 5.11, 5.12, ...
0
votes
1answer
96 views

Filtering posts by WORD in custom field

I need to filter my posts in categories pages, by showing only posts that have specific WORD in custom field value. I need php code that i should add in loop for this category. Details: I need loop ...
2
votes
1answer
39 views

How do I query for a post by custom field?

I have a custom field called "song-id" and I'd like to lookup a post by a song-id value. Can someone give me the code snippet for it? (bonus: also looking for a code to use the permalink in the post ...
1
vote
0answers
475 views

filter custom field values $min $max

The user needs to query posts by entering a $minPrice, $maxPrice and a category value. Here is my query which returns no results: function result() { $result = array( 'cat' => ...
2
votes
4answers
2k views

Order posts by custom field and if custom field is empty return remaining posts

I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field. $paged = ...
2
votes
1answer
126 views

Can ordering post list by meta_value cause performance issue?

For some code refinement and to add new features to my plugin, I want to display posts ordered by specific meta column value like this; query_posts($query_string . ...
2
votes
3answers
5k views

Return all custom meta data for one custom post type

I've set up a custom post type which has three custom meta fields: name, latitude, longitude. Each post already shows the name on an integrated map based on it's latitude and longitude. I now would ...
0
votes
1answer
146 views

How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?

I need to know the most efficient method to grab 3 pieces of data from from multiple posts: Post title Thumbnail Custom Field I am attempting to build a Google map of posts using data stored in WP ...
2
votes
1answer
402 views

Order by value in serialized custom field

Quite a pesky problem here. I've taken over a site that contains multiple information, serialised, within a custom field. For example: if ($new_query->have_posts()) : while ...
0
votes
1answer
232 views

Get author total post votes from post meta

In author.php, i have the list with the posts written by the author. I'm trying to get the total number of votes, from the author posts. All posts have a post_meta with a numbered value. i need to ...
0
votes
1answer
2k views

query posts with custom field meta value

<?php query_posts( array( 'showposts' => -1, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => ...
0
votes
2answers
3k views

Show posts from category specified using a custom field

I have a post that shows the titles and excerpts from a specific category underneath the content. Currently this is coded into a specific template like this: <?php ...
0
votes
1answer
132 views

Problem with writting correctly a query posts args in Wordpress

In my posts custom fields, I have a meta_key named ending. The value of it is a date in the form of 30-11-2011 (dd-mm-yyyy). I tried this below but with no luck. ...
1
vote
2answers
331 views

how can i use custom field in query post

I want to get all featured items using query post. featured is meta_key using custom field plugin. I tried bellow,but it failed $featured_item = new ...
5
votes
1answer
5k views

Using meta_query, how can i filter by a custom field and order by another one?

With the following code (in functions.php) my posts (of CPT event) are ordered by _end_date instead of _start_date. What's the proper solution to this as of WP 3.1.3? Of course I'd like to avoid using ...
2
votes
1answer
586 views

How to hook get_terms() to only show count of posts that have custom meta

Here is what I have: A custom post type that has a custom meta value added to a post that stores the posts expiry date. When the post passes this expiry date it no longer shows on the site. This ...
1
vote
3answers
17k views

Custom query with orderby meta_value of custom field

Aa you know, as of WP3.0 there are options for custom advanced queries, which is great. As of this, some query parameters of custom fields like meta_key, meta_value were deprecated for the new ...
1
vote
1answer
1k views

How to select posts from multiple categories and metavalues?

I need to select posts who are in multiple categories and have certain post metavalue. I can select multiple categories with query_posts( array( 'category__and' => array(1,2,3) ) ); But also I ...
1
vote
1answer
1k views

Order query by meta_value with multiple custom fields

I would like to get ordered all my posts with multiple cutom fields (WordPress 3). Exemple, I've 2 custom couple meta_key/meta_value : " order_submenuexpositions / numeric " " ...
0
votes
1answer
246 views

Display agents (custom post type) alphabetically, except one who always shows last

I would like to display all agents a-z, except there is one agent who should always show up last. Ideally I'd like the ordering to be done from the value of a custom field, dName. I was looking ...
11
votes
4answers
7k views

what is the correct way to compare dates in a WP query_posts meta_query

I have a query_posts call in a WP template. Through the use of the More Fields Plugin I can give the site admin the ability to create an event (custom post type) and then enter a date which is ...
1
vote
1answer
5k views

Query Posts or Get Posts by custom fields, possible?

If I were to take a standard query post. <?php query_posts('post_type=payment'); while (have_posts()) : the_post();?> Only this time I would like to query the post by 2 custom fields that it ...
0
votes
1answer
2k views

get all posts with certain meta data

I'm developing a plugin made on the original calendar. My wordpress is based on real events and I want to keep trace of theme on the calendar. So I added a custom field in the post which is the end ...
1
vote
3answers
4k views

meta query not showing any results?

I'm trying to show result for a custom field that is not empty on a custom post type but getting no results? <?php if (have_posts()) : ...
1
vote
2answers
4k views

query_posts and only show results if a custom field is not empty

How do I query_posts and only show results if a custom field is not empty or has a value. I want to put in a url in a custom field and only show these pages if there is a url? current code but I ...
1
vote
1answer
2k views

How to insert content from another Custom Post type into Post?

Say I have a custom post type called "Performers". This gets populated with different bands/performers. These posts have a featured image as well as custom fields (mp3 file, facebook link, myspace ...
4
votes
1answer
4k views

How to filter custom posts by tags and custom fields?

I'm planning a site for a client who wants users to be able to filter upcoming events by the following criteria: Type i.e. Comedy, Theatre, Music etc. Date Daily or Weekend Duration Daily or Half ...
0
votes
1answer
741 views

simple fields plugin custom query

I have a collection of posts for families. I'm using the simple fields plugin for handle members of the family. Is there a simple way to query posts based on values from the custom fields created by ...
1
vote
1answer
9k views

using multiple meta_key and meta_value in query_posts

how can i use multiple meta_key and meta_value in query_posts? For example, I want to find multiple content with two different meta_key and meta_value. How do I do this? i using this code but not ...
1
vote
3answers
2k views

Query on custom field count?

I have the following code: <div id="pc" class="smartbar-content"> <ul class="smartbar-items"> <?php $paged = ( get_query_var('paged') ) ...
1
vote
2answers
2k views

Query posts by category AND custom field, then ORDERBY another custom field - help!

OK I need to query posts using the following criteria: category_name=office, meta_key=featured_post, meta_value=Yes and order these results using a second custom field which has a numerical value ...
1
vote
1answer
2k views

meta_compare seems to be treating values as strings instead of integers as expected

Trying to use meta_compare as suggested in the codex: query_posts('meta_key=miles&meta_compare=<=&meta_value=22'); Here is my code: global $wp_query; query_posts( array_merge( ...