I have a plugin that allows people to create content modules via custom fields. They can then use shortcodes to insert a specific content module within their posts/pages. To make it user friendly, I've created a tinyMCE button that pops up and gets settings from the user.
I would like to be able to query the database from within this popup so that the content modules (custom post type) show in a dropdown menu and the user can select which one they want to show. For example, something like this:
<select id="content_box_value" name="content_box_value"> <?php $boxes = array( 'post_type' => 'wp-content-box', 'numberposts' => -1); $post_box = get_posts($boxes; foreach( $post_box as $key ) : setup_postdata($key); ?> <option value="<? echo $key->ID; ?>" <?php selected($options, $key->ID); ?>><?php echo $key->post_title; ?></option> <?php endforeach; ?> </select>
Does anyone know of a simple way to accomplish this? I know its doable via ajax however I didn't know if there was something quicker to utilize?