The custom post type is being register as name
, not snippet
as is being called in add_meta_boxes
action. This is because a PHP var is passed inside single quotes and it is not being interpreted.
Change this:
register_post_type('$name', $args);
To:
register_post_type($name, $args);
This also work:
register_post_type("$name", $args);
But never pass PHP variables inside single quotes if you want they be interpreted.
Also, it is recommended the use of add_action('add_meta_boxes_{post-type}', 'callback')
to create less unnecessary hooks for other post types (from codex).