How can i make a search box to search by custom field

The generated SQL for that query is going to look something like: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id) WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish”) AND ((wp_postmeta.meta_key = ‘culoare’ AND CAST(wp_postmeta.meta_value AS … Read more

Let users upload image(s) to the post from front end

wp_insert_attachment returns the resulting post_ID of attachment record created in posts table, so you will need to add these IDs (multiple) in the post meta table using update_post_meta as suggested in code below: $attchmentIds = array(); if ($_FILES) { foreach ($_FILES as $file => $array) { $newupload = insert_attachment($file,$pid); $attchmentIds[] = $newupload; } }; /*The … Read more

Need to have an archive widget which organizes and displays a custom post type using a custom date field

Yep. You can add a meta_query parameter to methods that query posts, such as WP_Query. This one below gets a custom post type between two dates (which are custom fields created by ‘advanced custom fields’ plugin) and sorts on one of these dates: $args = array( ‘post_type’ => ‘event’, ‘posts_per_page’ => ‘-1’, ‘post_status’ => array( … Read more

Output custom field value

I would suggest you could try something like this to insert the Skype id by using get_post_meta: if (get_post_meta($post->ID, ‘Skype_ID’, true) == true) { echo get_post_meta( $post_id, “Skype_ID”, true ); }

Search Results Page – Displaying Custom Meta Fields

You’ve got a missing ) and you’re passing true as a string and not a boolean value. So this line: $pName = get_post_meta($post->ID, $productName, ‘true’; Should in fact be: $pName = get_post_meta($post->ID, $productName, true); In light of your update why not do something like: echo ‘Product Name: ‘. $pName[‘productName’][0]; echo ‘Location: ‘. $pName[‘locationName’][0]; echo ‘Address: … Read more