View object is associated to the active Controller object each time a route is executed. It is the interface that handles how variables are passed from Controllers to Wordpress templates.
To expose a variable and make it available to the regular Wordpress templating use the View object’s
set($key, $mixed) method. This will globally expose a variable named
$key having a value of
$mixed to the templates.
In the controller :
1 2 3 <?php $this->view->set("song", $mysong); ?>
In a template file :
1 2 3 <?php if (isset($song)) : ?> <p><?php echo $song->post_title; ?></p> <?php endif; ?>