Please replace the old code with below code it will show you that it’s working
add_shortcode( 'bg_recent_post_grid', 'bg_recent_post_grid_shortcode' );
function bg_recent_post_grid_shortcode( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'category_name' => 'uncategorized',
'number_posts' => '1',
), $atts );
return bg_make_post_grid ( $atts['number_posts'], $atts['category_name'] );
}
function bg_make_post_grid ( $number_posts, $category_name ) {
$args = array(
'numberposts' => $number_posts,
'category' => $category_name,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
);
$recent_posts = wp_get_recent_posts( $args );
print_r( $recent_posts); die;
}
echo do_shortcode('[bg_recent_post_grid]');