Skip to main content
added 555 characters in body
Source Link

I am creating 2 custom post types, and with the one displaying a list of the posts in #2.

I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2.

I am using get_posts to create the array, and then echoing into the select.

$option_list = get_pages( array( 'post_type' => 'Partners' ) );
echo '<select name="activitymeta_sel" id="activitymeta_sel">';
  foreach ($option_list as $option) {
   echo '<option value="' . $option . '">' . $option . '</option>';
  }
  echo '</select>';

I must be missing something. Can anyone spread some light on my quest.

edit: The new code is below but still not getting the list of the post types, I know I am going wrong somewhere but not sure where.

echo '<select name="activitymeta_sel" id="activitymeta_sel">';
 echo '<option value="">Select Partners</option> ';
  $pages = get_pages('post_type=Partners'); 
  foreach ( $pages as $pagg ) {
   $option = '<option value="' . $pagg->post_title . '">';
   $option .= $pagg->post_title;
   $option .= '</option>';
   echo $option;
  }
 echo '</select>';

Thanks In Advance

I am creating 2 custom post types, and with the one displaying a list of the posts in #2.

I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2.

I am using get_posts to create the array, and then echoing into the select.

$option_list = get_pages( array( 'post_type' => 'Partners' ) );
echo '<select name="activitymeta_sel" id="activitymeta_sel">';
  foreach ($option_list as $option) {
   echo '<option value="' . $option . '">' . $option . '</option>';
  }
  echo '</select>';

I must be missing something. Can anyone spread some light on my quest.

I am creating 2 custom post types, and with the one displaying a list of the posts in #2.

I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2.

I am using get_posts to create the array, and then echoing into the select.

$option_list = get_pages( array( 'post_type' => 'Partners' ) );
echo '<select name="activitymeta_sel" id="activitymeta_sel">';
  foreach ($option_list as $option) {
   echo '<option value="' . $option . '">' . $option . '</option>';
  }
  echo '</select>';

I must be missing something. Can anyone spread some light on my quest.

edit: The new code is below but still not getting the list of the post types, I know I am going wrong somewhere but not sure where.

echo '<select name="activitymeta_sel" id="activitymeta_sel">';
 echo '<option value="">Select Partners</option> ';
  $pages = get_pages('post_type=Partners'); 
  foreach ( $pages as $pagg ) {
   $option = '<option value="' . $pagg->post_title . '">';
   $option .= $pagg->post_title;
   $option .= '</option>';
   echo $option;
  }
 echo '</select>';

Thanks In Advance

Source Link

Displayling list of Custom Post Type Posts

I am creating 2 custom post types, and with the one displaying a list of the posts in #2.

I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2.

I am using get_posts to create the array, and then echoing into the select.

$option_list = get_pages( array( 'post_type' => 'Partners' ) );
echo '<select name="activitymeta_sel" id="activitymeta_sel">';
  foreach ($option_list as $option) {
   echo '<option value="' . $option . '">' . $option . '</option>';
  }
  echo '</select>';

I must be missing something. Can anyone spread some light on my quest.