0
votes
1answer
140 views

query_posts orderby postmeta

I'm trying to retrieve a custom post type and order it by a custom date stored in postmeta. The custom date is a unix timestamp. The meta_query works correctly - it only retrieves posts with a ...
0
votes
1answer
61 views

How to query post ids liked by the Author

I'm using wti_like plugin and this is how i get the number(count) of post liked by the author // Get the author object $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); // Get the ...
0
votes
2answers
123 views

HM CMB: Post Select Field for CPT ID

'm using human made's custom meta boxes framework (https://github.com/humanmade/Custom-Meta-Boxes). Using the post select: array( 'id' => 'example-field-post-select', 'name' ...
1
vote
1answer
88 views

Get posts between custom dates

I created an event CPT and a meta box with a date. I saved the date as post_meta in the form dd.mm.yyyy. Now I want to create a shortcode that queries all posts which's dates meet the condition ...
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
229 views

Exclude posts by post meta value

I have constructed this query to sort posts on the home page by a set position number in a custom field. However, I need to be able to exclude posts with the position set to '0'. Below is the code ...
1
vote
1answer
406 views

is there a way to show the the post title after the image?

Trying to show the post title after the image in the main blog page and single page, I have tried to edit the content.php but unable to achive the result I need, which is basiscally IMAGE TITLE META ...
1
vote
0answers
92 views

How to increase load time of an archive/search page (WP_Query)

I'm currently looking at why the archive and search pages take so long to use, and have found that the bulk of processing time is spent on the query_posts that is called before the template has even ...
2
votes
2answers
171 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 ...
-2
votes
1answer
82 views

Limiting the amount of posts this displays

I currently have this query_posts that i have done, (I am new to PHP!) And would like to know how I would go about limiting it to latest 4 posts and 4 posts only.. <?php ...
1
vote
1answer
180 views

Query posts by meta_key whose value is an array

Let's say I'm modifying the default posts query: add_filter( 'pre_get_posts', 'my_filter' ); function my_filter( $query ) { $query->set( 'meta_key', 'my_rating' ); $query->set( 'orderby', ...
1
vote
0answers
221 views

Querying posts with meta value that begins with a certain pattern

I am trying to create a search filter using meta_query. The only problem I'm having now is that I can't compare with wildcards. I think that's how you word it? $keyword = 'sos'; $tlds = ...
0
votes
1answer
1k views

order posts by meta value on posts page

I've been reading alot about how to order posts by a meta_value, but I can't seem to get it to work for me. My meta_key is called date, and it is stored as yyyy-mm-dd. Here's where I've gotten to so ...
1
vote
1answer
36 views

I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?

My website is a multi author blog. I would like to give special promotion for the first 100 published posts in my blog? What is the proper way to implement it? I mean should i add some meta value ...
3
votes
1answer
2k views

Filtering posts by post meta data

I want to filter posts in such a way that only posts, for which get_post_meta($post->ID, "project_cat", true) (it returns a post ID) is equal to my specified value, are shown. Any way to do this? I ...
0
votes
1answer
225 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 ...
1
vote
1answer
442 views

Query_post($args)

it is possible to use a array by the this query? This Version doesnt work: $args = array( 'order' => 'ASC', 'meta_key => array('city_1','city_2), 'meta_value' => ...
1
vote
1answer
451 views

IF.. post meta show… Conditional Tag Help…?

I have the following conditional tag, which a friend helped me with... Currently it works doing.. 1) If a featured image just show that. 2) If images attached show featured image wrapped in a link ...
1
vote
2answers
6k views

WordPress how to sort by meta value?

how in WordPress can I sort by meta value? In meta value I have "price" (float). I make this query, but always get "Sorry, no posts matched your criteria". $posts = query_posts( $query_string . ...
9
votes
3answers
8k views

Order by meta value or date?

Got a custom field called startDate but its only on a few events. I was wondering if it isn't set for a post I could use post_date to generate the posts list? // if meta_key _postmeta.startDate isn't ...
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 ...
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 ...
0
votes
2answers
688 views

Exclude from the query posts with meta_key and meta_value

I use this function to exclude from the query posts that are 30 days old, function filter_where($where = '') { //posts in the last 30 days $where .= " AND post_date > '" . date('Y-m-d', ...
1
vote
1answer
708 views

query_posts() on key's value, or key's existence

I recently started using simple fields on a project to differentiate between types of posts. All posts from now on will have one of four possible meta values associated with this (Story, Article, ...
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
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( ...
2
votes
2answers
736 views

Conditionally Query Custom Post Types by Post Meta for Blog Home Page?

(Moderator's note: The question's original title was: "Custom query: Show custom post types plus custom post type with post meta on blog homepage") I'm in need of help with a custom query. I have ...
0
votes
1answer
801 views

Custom query with query_posts doesn't show post without certain meta_key

I'm using query_posts to sort order certain categories. My code look like this: query_posts('category_name=abs&orderby=meta_value_num&meta_key=field_ordering&order=DESC'); This does ...