Support » Plugins » Hacks » metabox error, excerpt disapper by while loop

  • Hi,
    I have made a meta_box for my custom post an in there I whant the user to choose a page or a post that the custom post will link to.
    But I have a problem. this is the function that puts all permalink i a select. But when I do this function in my meta box kode the saved excerpt disapper. I have tried it and I know it is something wrong with the while loop but what?

    function get_permalinks(){
      $query = new WP_Query( array( 'post_type' => 'post') );
      while ( $query->have_posts() ) {
        $query->the_post();
        $select_url .= "<option value='".get_permalink()."'";
        $select_url .= ">".get_permalink()."</option>";
      }
      $select_url .= "<option>Sidor</option>";
      $query = new WP_Query( array( 'post_type' => 'page') );
      while ( $query->have_posts() ) {
        $query->the_post();
        $select_url .= "<option value='".get_permalink()."'";
        $select_url .= ">".get_permalink()."</option>";
      }
      return $select_url;
    }

    Please help me/
    Granskog

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘metabox error, excerpt disapper by while loop’ is closed to new replies.