php - Show a list of titles of all the custom posts in backend -


in wordpress theme, there's custom post type called "slider".

so, need sliders select box in theme options page. so, user can select slider wants display.

how done ?

never mind, found myself

<?php      $type = 'sliders'; // whatever post type      $args=array(       'post_type' => $type,       'post_status' => 'publish',       'posts_per_page' => -1,       'caller_get_posts'=> 1     );      $my_query = null;     $my_query = new wp_query($args);  //check if there posts                                     if( $my_query->have_posts() ) {       while ($my_query->have_posts()) : $my_query->the_post(); ?>        <select>          <option><?php the_title(); ?></option>        </select> <?php       endwhile; } wp_reset_query();  // restore global post data stomped the_post().  ?> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -