Articles of custom field

Custom Posts Hierarchy? (State/City/Restaurant)

Question: What is the best way to create a hierarchy structure (also called parent/child relationships) between custom post types? For example, we currently have 3 post types: States, Cities, and Restaurants. Each Restaurant will be in a city, and each city will of course be in a state. So for example, Joe’s Crab Shack would […]

Prevent duplicate posts in wp_insert_post using custom fields

My source links are something linke this : http://sample.com/entertainment/default.aspx?tabid=2305&conid=102950 http://sample.com/entertainment/default.aspx?tabid=2418&conid=104330 http://sample.com/entertainment/default.aspx?tabid=2429&conid=104264 http://sample.com/entertainment/default.aspx?tabid=2305&conid=102949 . . . I cache content form links.I use wp_insert_post to post cached content from source site to wordpress: $my_post = array( ‘post_title’ => “$title”, ‘post_content’ => “$content”, ‘post_status’ => ‘draft’, ‘post_author’ => 1, ‘post_category’ => array(1), ); wp_insert_post( $my_post ); I want […]

Meta_query and numeric comparison

I have a WP_Query with meta_query filter on meta_value. if( ($capacity != ”) && ($capacity > 0) ) $filters[] = array(‘key’ => ‘mb_capacity’,’compare’ => ‘>’,’value’ => $capacity, ‘type’ => ‘NUMERIC’); and then later i set the ‘meta_query’ => $filters of the query The custom field mb_capacity represents an number but WP store it as a […]

Custom meta fields for specific custom type only

I’ve got a custom post type curiculum and a metabox that saves a value to a custom field. However this custom field is added to another custom post type (created by an e-commerce plugin) wpsc-product. This is a snippet of the code that deals with the metabox. The question is, how to prevent the custom […]

Automatically populate a hierarchical taxonomy from a custom field

I’ve got a vexing how-to that I’ve not found any help on. I have a custom post type that has a custom field with a date in it (format: yyyy-mm-dd-t). When a post is published or edited, I would like to have a function that automatically populates a hierarchical taxonomy with the year and date. […]

Unique key for each row in a repeater field

Is it possible to have a unique key for each sub fields in a repeater field? I don’t want to use the array index, because the array index can be changed, when adding new rows between existing rows. I have checked the meta keys in the database, but the meta keys are changing too. Can […]

Author Page Custom Query WHERE author OR OR

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 trying to do for the author’s profile is get all the posts for the current user profile where the user is: the […]

Including Database Generated Pages in Site Search

Our library uses a separate little php/mysql app and wordpress template pages to display lists of resources for users. The resources are not included in site search, of course, since the pages are generated on the fly. Lookup begins at a top level page with a search, alphabetical and subject browses. Users can enter the […]

Revolution Slider Orderby Two Custom Fields

I have create Revolution Slider which load the custom post type, Events. There are two custom fields, Event Start Date and Event End Date. I would like to display order by Start and End date. Because now only able order by Start date and if same Start date, then will order by Title. Here is […]

Add custom fields to search

I want to add a custom fields (“introduction” and “ensavoirplus”) to search of WordPress, but the SQL code is not exact. I don’t understand if i do a mistake or if WP don’t can do this. But my attempt fail… I don’t know why because I do exactly what the codex says. This is my […]