display widget checkbox selection on frontend

Without actually knowing what you’re trying to achieve I see the following problems:

  • $post variable is not defined in your widget() method. Try setting it using $post = get_post( get_the_ID() ) for instance.
  • By the time you call foreach ($posts as $post) { ... } $posts variable is also not set. You need some query for this one I guess – WP_Query() or get_posts()

In order to effectively catch such problems set WP_DEBUG and WP_DEBUG_LOG constants both to true in your wp-config.php file then you’ll be able to monitor wp-content/debug.log for notices and errors. Good luck.