• Hi,

    I’m trying to create a drop down box that is populated from a certain Custom Post Type,

    For example

    I have 20 Courses in the Course Custom post type,

    And I want them to display in a drop down list somewhere on the site,

    I Started with displaying categories from all Custom post types,and tried to adapt it to display the Custom post type But It doesn’t return’ anything just Multiple Empty Dropdown Boxes.

    If anyone has done this before and can point me in the right direction it would be greatly appreciated

    Stewart,

Viewing 2 replies - 1 through 2 (of 2 total)
  • I would like to do the same thing. I’m trying to create a dropdown list of ALL the custom posts of a single custom post type. This list will appear in the side bar on ONLY posts of that custom post type. I can’t seem to locate any help with this.

    Anyone find something or build something?

    Moderator keesiemeijer

    (@keesiemeijer)

    Try it with something like this (untested and very simplified):

    <?php
    $mypostype = get_posts('post_type=myproduct');
    if($mypostype) : ?>
    <form action="" id="myform">
    <label for="myselect">Post Types</label>
    <select id="myselect" name="select_post_type">
    <?php foreach ( $mypostype as $mypost  ) : ?>
    <option value="<?php echo $mypost->post_name; ?>"><?php echo $mypost->post_title; ?></option>
    <?php endforeach; ?>
     </select>
    </form>
    <?php endif ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom Post Type Dropdown’ is closed to new replies.