1
vote
1answer
35 views

Create Pop-Up Box with Custom Field Content Inside the Loop

I tried this using ThickBox first, then tried using some code I had that worked on another website... Total failure. The Goal: I have a custom post type (product) with a ton of custom fields. I also ...
0
votes
2answers
127 views

How to query categories with Advanced Custom Fields?

I'm currently using Advanced Custom Fields and I was wondering if anyone know how to filter categories by custom fields? I have a custom field in my categories using the checkboxes field. I want to ...
0
votes
0answers
37 views

Update the values from specific custom fields for 70 pages

I have a wordpress site with more than 70 pages of different brand car offers. Each page has a custom field named Price with a numeric value. This is what I got so far: function ...
0
votes
2answers
54 views

If Elseif Query

I'm trying to work this query - the first if clause works, and the else works, but the middle clause, elseif, doesn't work. <?php if(get_post_meta($post->ID, 'TourURL', true)) { ...
4
votes
3answers
484 views

Query custom post type by custom field

General Info I used the plugin WP Types (wp-types.com) to create a custom post type called "artist". In WP Types you can also set another post type as parent post type. This is not possible by ...
0
votes
1answer
100 views

query specific posts according their custom fields, using sql SELECT

My posts have a bunch of custom fields, to help insert and display custom info easily. I am trying to build a search that would select and display posts according values of specific 2 custom fields. ...
0
votes
0answers
124 views

Filter CPT based on meta box value using Flexible Posts widget?

I'm using the Flexible Posts Widget to display a list of "deals" (a custom post type) in my sidebar. I'm also using that plugin's capacity to use a custom template to control the display of that ...
0
votes
1answer
48 views

Meta_query not filtering posts

I'm trying to filter out 'properties' on a page based on whether they are vacation or long-term rentals. Right now, the results of the following query displays all properties, not just either vacation ...
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
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
131 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
1answer
50 views

Get multiple posts with some custom fields efficient

Is there an efficient way to get some posts with (some of) their custom fields in one go? I have a custom post with some custom fields and would like to create an overview page where I display all ...
0
votes
1answer
319 views

How to add a prefix to existing custom fields over MYSQL query?

I've got the problem that after a plugin update I can make the custom fields on our directory site searchable, but only custom fields which get the prefix booking_ to them. Now there are some pages ...
0
votes
0answers
139 views

List number of posts with a specific meta_key for each meta_value

I would like to list my posts by a specific custom field. At the same time, for each custom field, I would like to count the number of posts with a specific custom field value. I have a custom field ...
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
1answer
679 views

Upcoming Event: How do I sort database by custom date field, but ignore past dates?

I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do: Query the "events" custom post type ...
0
votes
2answers
344 views

How to exclude custom fields from search queries?

I'm building a hotel search engine and I've first created a custom content type "hotel" with Types & Views Toolset. I'm using "Search everything" plugin to query custom fields and custom taxonomy ...
0
votes
1answer
1k 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
408 views

Trying to reorder posts by custom field

I'm running WooCommerce and am trying to get the default product display to be sorted by the sku field in ascending order. So far I've come up with this: /* Order products by SKU */ function ...
0
votes
1answer
264 views

WP_Query () using taxonomy, custom post types

I want to implement this query using WP_Query(). SELECT * FROM wp_posts as posts LEFT OUTER JOIN wp_postmeta as postmeta ON (postmeta.post_ID = posts.ID) LEFT OUTER ...
0
votes
1answer
214 views

Loop to display random posts only if a custom field matches category

Working on a website and need loop that will show posts ONLY if custom field value is equal to the current category name. I have category 'fun' and custom field 'genre'. I would like to show on ...
0
votes
1answer
994 views

$wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?

I have a custom post type 'event', a custom meta field 'event_date' and a custom taxonomy 'locations'. I want to query $wpdb to retrieve posts in this way posts must be of the 'event' post type ...
1
vote
1answer
77 views

Limits, not all post are showen when querying for posts by view count

I'm having some difficulty getting a loop that gives me post by most viewed. I started by following this tutorial ...
1
vote
0answers
71 views

Why orderbyb meta_value_num won't affect the generated SQL Query order?

I've exhausted myself with this and I couldn't figure out why when I do this $myposts = new WP_Query( array('numberposts' => 5, 'offset' => '0', 'post_type' => 'noticias', 'orderby' => ...
2
votes
1answer
38 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 ...
5
votes
6answers
3k views

How can I make wp-pagenavi work on a custom query built upon a form submission?

I've also posted this on the wordpress support forums, for scribu's wp-pagenavi plugin: http://wordpress.org/support/topic/plugin-wp-pagenavi-custom-query-form-submit-part-2?replies=1 My situation: ...
1
vote
1answer
545 views

Sort posts based on multiple custom fields

I have a three custom fields Meta Key → YOUR_PREFIX_newcar_body_type Meta Key → YOUR_PREFIX_newcar_transmission_type Meta Key → YOUR_PREFIX_newcar_variant and I have to sort posts ...
0
votes
1answer
128 views

Get post ids sorted by meta_key

I have defined a post_view_count meta_key to store the number of post views. I would like to get an array of post ids sorted by post_view_count value to use in the functions.php file. Thanks.
0
votes
1answer
56 views

How to query for posts with either one or another custom field

Need help querying for posts with either one or another custom field. Not sure how to use the 'or' operator here, but something like this the blow - Have tried these: ...
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 ...
0
votes
1answer
76 views

Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?

I´m building a real estate site where Estates is a custom post type. I want to be able to tick a checkbox or something similare on the edit page, where I can choose if the estate is for rent, if it ...
0
votes
1answer
465 views

Custom Query: query by post custom meta data

So I have a custom post called event, but I need to query only those posts which have a custom metabox(is a checkbox) called `Show On The Homepage: and only if that checkbox is checked. <?php ...
0
votes
1answer
482 views

Get array of posts based on custom field values

I'm looking to pull up an array of posts based on custom field values: function GetPrimaryLinks($product){ echo '<ul>'; $args = array( 'product' => $product, ...
0
votes
1answer
273 views

How to check if custom field exists in this widget query

How can I include this (or something similar) <?php if ( get_post_meta($post->ID, 'url', true) ) { ?> <a href="<?php echo get_post_meta($post->ID, "url", $single = true); ...
0
votes
1answer
279 views

query usermeta from custom field

I am using a plugin to create custom fields in the user registration. I have created a check box field called g300 which is the name of the meta_key stored in wp_usermeta. It looks like the value ...
3
votes
1answer
3k views

Meta Query with AND & OR?

I'm trying to do some filtering for some posts in WP_Query, but I can't seem to get the right condition. Basically what I wanna do, is get posts that have the custom field event_data (sorted by this ...
0
votes
1answer
230 views

How to query an out put value?

I have this custom query that Im working on and I need to be able to query output values as well as actual stored values. Example: $string = "This is #*&^% a test"; $string = ...
0
votes
1answer
315 views

Only show content slideshow if “slideshow” custom field exists

I am developing a theme for general release and there is a large content slideshow on the homepage. I have included a checkbox meta box in the post edit screen that allows users to determine which ...
1
vote
3answers
251 views

query in category.php repeats itself

I'm need some help on my query. I'm building up a category page where on top a post need to show where custom field key 'uitleg' has value 'ja'. Per category there is only one post with that value. ...
1
vote
2answers
1k views

How to rename a custom field?

I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. Question 1 I am ...
0
votes
1answer
715 views

Searching with Multiple (Parallel) Criteria on Custom Fields?

I'm just an basic Wordpress user. I need to make search box with multiple criteria inputs (multiple conditions) to search inside various Custom Fields. For example including following Custom Fields: ...
0
votes
1answer
737 views

How to query posts by month based on date custom field?

I currently created a custom field for a custom post type that stores a date in the format dd/mm/yyyy is there a way to query the posts by the month? I "kind of" got the functionality I need using ...
0
votes
1answer
88 views

querying a custom field

I'm trying to hack a plugin to show the contents of a custom field where its currently showing the title. how would I get this to show a custom field called restaurants instead? Thanks, ...
1
vote
2answers
448 views

Conditional custom field query

I'm working on a job board-type site, and the client want to sell featured posts. They want the featured posts to expire from showing up in the "featured" section after a predetermined period of time, ...
0
votes
1answer
143 views

Query pulling a single post per month

I am trying to only show a single post per month on a query. I can set the date as a variable and use something like the php array_unique function to check the dates and only echo out unique ones, ...
2
votes
1answer
446 views

Plugin similar to Taxonomy Drill-Down for custom fields?

Is there a plugin available that does for custom fields what Scribu's excellent Taxonomy Drill-Down (formerly called Query Multiple Taxonomies) does for taxonomies?
1
vote
2answers
947 views

Count how many posts have a custom field set

I've added some code to my templates which automatically adds custom fields to cache some data that each post pulls in. Is there a way that I can track how many posts have had this custom field set?
-1
votes
1answer
1k views

WP insert post PHP function dynamically generated Custom Fields

Further to my previous question WP insert post PHP function and Custom Fields We have a working insert post function that can also send over custom fields without yet knowing the ID. Please see the ...
0
votes
2answers
329 views

How to get events using multiple custom meta fields?

I need to grab a list of current events. The events have a start and end date so I need to be able to select a range as opposed to just getting any list of events that have an end date that is after ...
0
votes
2answers
532 views

Custom Field Date Problem

I have a custom field called expiry_date with a value of let's say 2010-12-11 00:00:00. What I would like to do is, in my query loop, only return posts with this expiry_date custom field attached to ...