get value from post to sidebar

You did not explain your question well so I am guessing quite a bit but I think you want something like this:

function post_ids_wpse() {
  global $wp_query;
  $ids = wp_list_pluck($wp_query->posts,'ID');
  $scs="";
  foreach ($ids as $id) {
    $scs .= "[wp_value id='{$id}']";
  }
  echo do_shortcode($scs);
}

That is very crude. You should check that the various values are sane before trying to use them, for example.

The idea is to grab the main query object from the page and create shortcodes from the IDs it contains.

tech