I created Custom Post Type. Now I want Custom Post Item in Select Box. Can i display?

  • Can you clarify a little bit about "select box" – bravokeyl Jul 2 '16 at 11:07
  • Drop down selection box – imran ali Jul 2 '16 at 11:18
  • 1
    Have you started trying to write any function for that? Post it here so others can see and give suggestios. – emilushi Jul 2 '16 at 11:44

Google code for displaying custom post items. Fetch all the custom post items in an array and then use a simple html of a drop down and put it in a for loop which will go through all the elements of custom post type. In the value attribute of drop down use the current array value.

Below is the html code for drop down wrap it in a for loop and add values as custom post type items.

You can also fetch your cost post related items using wpdb class of WordPress using a select query before this.

for each (result as results)
  <option value="<?php echo results->custompostItem ?>">Volvo</option>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.