The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
22 views

WordPress Screwing Up 'orderby' => 'meta_value_num' in 'pre_get_posts'

I have a bunch of _ai_price_int meta values set up as just numbers. This is how the table looks: meta_id, post_id, meta_key, meta_value 1309, 1111, _ai_price_int, 6550 1310, 1115, ...
1
vote
2answers
28 views

Query Multiple Meta Values and display only when it has both meta values

I've been stuck on a problem for a while now and I can't seem to figure it out. I want to query posts and only display them if their 2 meta values checked contain the ones I have queried. For ...
0
votes
1answer
27 views

How can I use 'orderby' => 'meta_value_num' to order by the numerical value even if the value starts with a word?

I'm using 'orderby' => 'meta_value_num' to order some boats I have as a custom post type, the meta values ordered by, are boat models, which are normally just numbers but if you look at this page: ...
0
votes
0answers
60 views

Wordpress Admin Panel Search posts with custom post meta values along with title

Trying to modify default admin search by including search by custom post type fields, Below is my code, function custom_search_query( $query ) { $custom_fields = array( // put all the meta ...
0
votes
1answer
54 views

Does meta_value (array) work with 'orderby'?

My goal here is to query posts by a meta_key, with the values falling in between 1-100. When pulled, it is suppose to be ordered by ascending starting from 1 to 100. $post = array( ...
0
votes
0answers
49 views

How to filter a meta key with the meta values?

I have a custom post type wich I'd like to filter on a meta value. I already can sort the meta values from a meta key with the following code: // Register the column function status_column_register( ...
0
votes
1answer
81 views

Sort column on meta key and meta value

In the WordPress backend I'd like to sort a custom post type column on a meta key and meta value. The meta key is called 'status'. I've got three different meta value's for the 'status' key. How can ...
1
vote
3answers
522 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
15 views

query multiple posts orderby two custom fields? [duplicate]

I would like to query my two custom post types and sort them by a custom field if it isset . they are 'job_ispaid' and 'blogger_ispaid' which are both either 0/1 and also displaying the post in date ...
0
votes
0answers
54 views

How to order query by meta value added date

I have a movie trailers website. There are usually two or three trailers on the same page for a movie. I add trailer urls using multiple custom fields. When there is a second or third trailer I simply ...
0
votes
0answers
82 views

Custom Field: Display only if a specific key is selected outside the loop

I might be doing this all wrong. I have a custom field called "enable_adsense" and the value can be either "yes" or "no" What I'm trying to do is display something if the value is "yes" and something ...
0
votes
1answer
21 views

How to output meta_key in wp_postmeta?

I have a meta_key in wp_postmeta called _su_description. How do I output its value?
0
votes
1answer
278 views

Query multiple meta values

I'm working on a 'checkbox filter' to query posts by checked values. See this link (EDIT: As you can see there are just 2 posts in this link, as soon as the user checks for 'MINI' it gets a good ...
0
votes
2answers
69 views

Sorting past events by month

I have a site that lists upcoming events and past events. In my category-past-event.php template, this is how I've gotten past events appear in descending order (from most recent to oldest): ...
0
votes
2answers
89 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
65 views

updating one custom meta field only

i am trying to update only one custom field that is store in serialized form. By updating that field my other custom meta fields becomes blank/empty. how can i update only a specific meta value ...
0
votes
0answers
57 views

Sort by user meta data

I am using the plugin: ep-display-user and can't get it to sort by meta. This is my code: function epdu_get_users($visible){ $user_ids = $this->wpdb->get_col("SELECT ID FROM $this->table ...
0
votes
1answer
272 views

AJAX pagination call to get_posts with an offset and a meta_value_num sort returns same post on adjacent pages

I have a simple AJAX pagination that seemed to work just fine, calling one Wordpress page (not ideal, I know) with a pagenum and a sort order arguments and it returned 4 custom posts per call. The ...
2
votes
1answer
901 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
1answer
161 views

How to get a value from comment meta

I've add the field country in the comment form. Working nice and I can see the value in the table commentmeta. Now I try to display this value in my comment list. In my single.php I call the list ...
0
votes
0answers
193 views

Check if meta_key exists in wp_list_pages

I have added a custom field (using Advanced Custom Fields plugin) to a page allowing you to show/hide it with a simple checkbox, i want to filter out these pages if a user is not logged in so i am ...
0
votes
2answers
393 views

IF Custom field value equals ZERO

I am trying to use the following code to check for my custom field for a value of ZERO to then display my div <?php $mp_price_sort = get_post_meta('mp_product_price'); if ($mp_price_sort == '0') ...
0
votes
2answers
64 views

How to show or hide a post based on meta_value selection?

How would I go about hiding a post based on a meta_value selection done on the back end. The usual method is to just change the post status from Publish to Draft however, I want this to work based on ...
0
votes
1answer
93 views

Saving zero as meta value

I have a meta_key called "_ordre" and each time I create a new custom post, a new meta_value is set for that meta_key. The thing is, when I set the value of '_ordre' to 0, the meta_value is not saved ...
0
votes
1answer
899 views

query posts and custom post type with meta key

I'm trying to query all-in-one-event-calendar's custom post type ai1ec_event and normal wordpress posts in a slider on my home page. That works pretty well. Now I want to query only the posts with ...
1
vote
1answer
119 views

Permalink structure by Post Meta value

I have the following issue: Two Custom Post Types, lets call them cpt1 and cpt2. In cpt2, I have a custom meta box in which you can select a post from cpt1, its post ID is stored in a meta value ...
1
vote
2answers
476 views

Multiple Values stored as array in Meta Query

I'm a little confused as to best practise for saving multi-select values in meta fields. Assuming <select multiple name="_casestudypost[]"> is my form field if I store ...
0
votes
1answer
103 views

Order by meta_key where value is serialized

I'd order post by meta_key but i've a problem with meta_value because is serialized object. I'd order my post per count value. a:2:{s:5:"count";d:9750;s:7:"timeout";i:1358466733;} I use below code ...
2
votes
0answers
95 views

Is it possible to orderby multiple meta_keys when using meta_value_num?

Reading through the order & orderby documentation, it's not clear to me whether there is any support to order based on multiple meta_key values. Obviously, using meta_query I can return posts ...
0
votes
1answer
98 views

Problem with meta_value order after update

I use following array and works fine... sort post by meta_key where value of t_count is a number: $args = array( 'posts_per_page' => 10, 'meta_key' => 't_count', 'orderby' => ...
1
vote
1answer
154 views

Job of meta_key meta_value fields in database tables

I'm researching the structure of WordPress database and there is something that really get me confuesd. Could someone please explain, what is the exact job of meta_key and meta_value fields in ...
0
votes
1answer
387 views

Add a default meta_value to new posts

I have a page template that allows users to create and update posts from the front end. I also am using 2 plugins, 1 that allows the user to rate posts from 1-5 stars and another that allows them to ...
1
vote
2answers
394 views

order by multiple meta_keys?

Hi i'd like to order by multiple meta_keys want to make it order using these keys adminscore + user_like + _count-views_all + comment_count combine these keys how should i array order it?? i try ...
-1
votes
1answer
387 views

Display a list of posts whose meta field values are equal to the ID of the post being viewed?

SOLUTION PASTEBIN LINKS:: http://pastebin.com/YmXVC1kn - Author Single Post http://pastebin.com/g0xgvxgh - Book Archive Template Please refer to these files here - solved by storing the post ID ...
0
votes
1answer
229 views

Run a check for multiple meta key values

I am having a heck of a time getting wordpress to display all values of a certain meta key correctly. I wonder if I am going about this the wrong way? My end goal is to run a check to see if there ...
0
votes
1answer
58 views

Order by meta values

I have 3 meta fields related to dates: year = 2012 release_date = 14 November 2012 release_date_db = 20121114 I need to show the posts from year 2012 sorted by release_date. I made this: ...
1
vote
1answer
107 views

Custom order for Mysql array

I have a Page of Posts, each post has a Custom Field "expired" which contains a date in the format YYYY-MM-DD which is used to order the posts. This date is used for a script that tells the visitor if ...
0
votes
1answer
229 views

List custom field values ​​in alphabetical order without repetition

The function below lists the custom fields as in this example: Frank Capra Alfred Hitchcock Woody Allen Woody Allen Frank Capra Pedro Almodóvar Pedro Almodóvar I introduce the values ​​in ...
1
vote
1answer
1k views

get_pages sort alphabetically by meta value

I operate a real estate website, and I have a list of homes we are selling. I am using a bunch of custom fields to store information about the homes. When you click on a home in the home listing page ...
0
votes
1answer
123 views

How to use array in function to get only value I want

I am trying to work this function in wordpress theme the way where I can get value only what I want and not all to gather. I am not much familiar with using array in function so I need you expert help ...
1
vote
0answers
325 views

How to use Meta Value Compare in WP_Query For Max and Min numbers

I am using WP_Query for visitor to filter the posts. The posts is about products. So in the filter, it has a field where user can select Maximum price and Minimum price. (Just like most of the ...
0
votes
1answer
1k views

Order by custom field date with ASC order

I've found several similar question but none of them explains why the below is giving me nothing with ASC order. It works with DESC. Basically it's a query that should list posts where the custom ...
0
votes
3answers
298 views

trim custom field text value and show (…)

I am using this code here: <?php $trim_length = 25; //desired length of text to display $custom_field = 'my-custom-field-name'; $value = get_post_meta($post->ID, $custom_field, true); if ...
1
vote
1answer
462 views

How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?

I know the question is quite ambiguous. Let me explain: I have a page that lists all posts with a certain value of a custom field. (Eg.: The page Rentals lists all posts with the value rental of ...
0
votes
1answer
207 views

Show array of meta_value in Edit Post Coloum

what I'm trying to do is add a new coloumn to Edit post page (done) and in that coloumn show data taken from a set of custom fields (partially done). This is my code (I use it as a plugin so it ...
0
votes
1answer
138 views

How to avoid duplicating same meta_value?

I have "publication_year" as meta_key for some images/attachments. I want to list all meta_values inside html table, but I don't want same publication_year value to repeat, my code is: <?php $args ...
0
votes
1answer
692 views

Override orderby to create list of users by custom meta_value

I'm having issues ordering a loop of users by a custom meta_value. Reading the Codex for get_users(), it doesn't actually say that you can use the meta_value for orderby. When I try to do it I get a ...
3
votes
2answers
1k 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 ...
0
votes
1answer
390 views

query_posts, oderby meta_value & print “future” posts

I have a custom post type for a cycling club uses to schedule rides. There is a custom field for these posts where the user selects the "ride date" with JQUI date & time picker. This information ...
0
votes
1answer
602 views

Custom WP Query from meta_value stored as serialised array

I'm using a Magic Fields 2 multicheck box to store Services which can be assigned to Case Studies. The data is stored as a serialised array in WordPress, and I need some help to extract the "related ...