Shortcode not working with WordPress updated

I am trying to learn wordpress and php development. I have been trying to create my own shortcode to add a json pull that I can parse into scheduled posts. I have the base php working – I’ve been experimenting in phpfiddle.org but as soon as I add anything specific to wordpress things stop. I am posting this as a new question because it seems like the latest WP update is causing a lot of issues.

I am adding this code to functions.php:

add_shortcode('aggrenda', 'aggrenda_func');
function requestAggrendaEvents() {
    $json = file_get_contents("http://aggrenda.com/mpellas/michael-pellas/events.json");
    $data = json_decode($json, true);
    return $data['events'];
}

function getPostInfo($aggrendaEvent) {
    return array(
        "title" => $aggrendaEvent['title'],
        "description" => $aggrendaEvent['description'],
    );
}

// Get the aggrenda events as an associative array
$aggrendaEvents = requestAggrendaEvents();

// Get the WordPress post information for the "next" event in Aggrenda
$postInfo = getPostInfo($aggrendaEvents[0]);

// TODO: Create a post using $postInfo
echo $postInfo['title'], '<br>';
echo $postInfo['description'], '<br>';

// See what exactly is in $postInfo right now
var_dump($postInfo);

I’m sure i’m missing something small. Can anyone help?

Solutions Collecting From Web of "Shortcode not working with WordPress updated"